Ok, so I RTFM and came up with using ls rather than list.
#!/usr/bin/perl -w
use strict;
use Net::FTP;
use Data::Dumper;
my $FTPdHandle;
my @FTPdDir;
$FTPdHandle = Net::FTP->new('ftp.funet.fi', Debug=>1);
$FTPdHandle->login("ftp","mypassword\@com.com");
$FTPdHandle->cwd("/pub");
@FTPdDir = $FTPdHandle->ls();
print Dumper(@FTPdDir);
$FTPdHandle->quit;
Which In turn produced the output:
$VAR1 = 'CPAN';
$VAR2 = 'FreeBSD';
$VAR3 = 'Linux';
$VAR4 = 'NeXT';
$VAR5 = 'NetBSD';
$VAR6 = 'OS';
$VAR7 = 'README';
$VAR8 = 'TeX';
$VAR9 = 'X11';
$VAR10 = 'amiga';
$VAR11 = 'archive';
$VAR12 = 'astro';
$VAR13 = 'atari';
$VAR14 = 'cae';
..
..
<snip>
Which reconciled perfectly with me doing it manually via the cmd line. Can I suggest using Data::Dumper to dump the contents of data structures rather than straight print? It will explicitily let you know if a value is undef, and if not it will recurse its way thru' any complex structures you many have. It also is very handy when you have the dereferencing blues to reverse engineer what you have already written (not that you'll ever need to reverse engineer what you've already written.. :-) )
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|