Pedro A Reche Gallardo wrote: > > Dear Adam, I have an small perl script (see below) to retrieve a list of > files whose filenames are listed in a file that is the the input of the > program. The program runs as it follows: getpdb.pl file; and "file" > just contain the two following entries > 2vaa > 2vac > > Somehow, I only cant get the first file, but not the second. I tried > several things I do not know what I am doing wrong. The script is > included in this e-mail and I will very happy if someone could let me > know what I am doing wrong.
I had a look at ftp://ftp.rcsb.org/pub/pdb/data/structures/all/pdb and the file pdb2vaa.ent.Z does exist but the file pdb2vac.ent.Z _does NOT exist_ > This is the script > #!/usr/bin/perl #!/usr/bin/perl -w use strict; > use Net::FTP::Common; > my @pdbs = <>; > > getpdb(@pdbs); > > sub getpdb { > my @ent = @_; > print "$ent[0]$ent[1]"; > > #my $pdbentry=$_[0]; > > my $dir = "."; > my $ftphost = "ftp.rcsb.org"; > my $ftpdir = "/pub/pdb/data/structures/all/pdb"; > my $username = "anonymous"; > my $password = "anonymous"; > > $ftp = Net::FTP->new("$ftphost") or print "Can't connect: $@\n"; ^ ^ You shouldn't quote scalars. perldoc -q "What's wrong with always quoting \"$vars\"?" > $ftp->login($username, $password) or print "Couldn't login\n"; > $ftp->cwd($ftpdir) or print "Couldn't change > directory\n"; > $ftp->type("I") or print "Couldn't change to > binary\n"; > > foreach my $key (@ent){ > chomp($key); > $key =~ tr/[A-Z]/[a-z]/; Why are you replacing '[' with '[' and ']' with ']'? tr/// does not use regular expressions. $key =~ tr/A-Z/a-z/; Or even better: $key = lc $key; Or, since you are not using $key any more. my $pdbentry = lc $key; > my $pdbentry = $key; > my $rcsbfile = "pdb" . $key . ".ent.Z"; > $ftp->get("$ftpdir/$rcsbfile", "$dir/${pdbentry}.pdb.Z") or The current directory $ftpdir was already changed 8 lines ago. $ftp->get( $rcsbfile, "$dir/$pdbentry.pdb.Z" ) or > print "Can't get $pdbentry\n"; > system("gunzip $dir/${pdbentry}.pdb.Z"); > } > } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]