Solved

Using ftp within perl

Posted on 2000-02-23
4
175 Views
Last Modified: 2010-03-05

I am not very good at handling references.

when I am using the dir command it returns a reference to a list. How do I actually print that list & / or loop through the list ?
0
Comment
Question by:benwilkinson
4 Comments
 
LVL 1

Expert Comment

by:olthoff
Comment Utility
you should be able to do either of the following

@files = $FTP->dir();
foreach $File ($FTP->dir()) {};
print $FTP->dir();


0
 
LVL 1

Expert Comment

by:malec
Comment Utility
Why not just

for ($ftp->ls) {print "$_\n"}
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
#or if you already got it as a ref
$ref = $ftp->dir;
for( @{$ref} ){ print "$_\n"}
0
 

Accepted Solution

by:
KishoreS78 earned 25 total points
Comment Utility
to a print the list of files in the directory
use $FTp->list([dir])command
to loop thru olthoff has suggested the answer that would work
or u could use
@files = $FTP->ls() if u r in the dirctory where u waanna list or loop thru
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now