in reply to Using FTP Without any Modules

Here's a snippet of code I've been using for a while, that cleans up a series of FTP sites by spinning through associative array (one entry for each site).

I wrote this years ago, before I knew any better way to do it, and it's been working fine.

To completely understand the code, you need to know that I have two arrays for each site... one stores the site address, and the other stores the login info.

So for ftp site 'example', then, you'd have:

$address{'example'} = "ftp.foobar.com"; $userpwd{'example'} = " user foo bar\n";
The code snippet to get all the files reads as follows:

$ftpcmd = "ftp -n " . $address{$myadd}; $ftpstr = $userpwd{$myadd}; open(TST,"|$ftpcmd"); print TST $ftpstr; print TST " prompt\n"; print TST " mget *\n"; close(TST);
I don't know that it's the best way to do it, but it's been working for me... I'd definately be open to suggestions for improving it.

Trek