chaskins has asked for the wisdom of the Perl Monks concerning the following question:
Any ideas why? Thanks Chrisuse Net::FTP; $address ="gamefiles.blueyonder.co.uk"; $hl_path = "/blueyondergames/halflife/patches/win32/"; $ftp = Net::FTP->new($address) or die "Can't connect:$@\n"; $ftp->login() or die "Couldn't login\n"; $ftp->cwd($hl_path) or die "Couldn't change directory to $hl-path: $!\ +n"; @lines_hl = $ftp->dir(".") or die "Can't get a list of files\n"; # lets check if the files are there. &checkFileExists("HL", @lines_hl); sub checkFileExists { print "pt = @_[0]\n"; if (@_[0] == "HL") { $patch = "11081109.exe"; } elsif (@_[0] == "CS") { $patch = "cs1415.exe"; #check this filename } print "patch = $patch\n"; foreach $file (@_) { if ($file =~ "$patch") { print "hit!\n"; &downloadfile($patch); break; } } } sub downloadfile { my $file = "@_[0]"; chomp($file); print "Downloading $file!\n"; $ftp->binary() or die "Can't change to Binary: $!\n"; #change i +t to a binary transfer. $ftp->get($file) or die "error downloading: $!\n"; $ftp->quit(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bad file number
by Abigail-II (Bishop) on Jun 12, 2002 at 15:49 UTC | |
by Anonymous Monk on Jan 08, 2006 at 19:42 UTC |