whollycow has asked for the wisdom of the Perl Monks concerning the following question:
#! /usr/bin/perl use File::Copy; ################################################ # # # program to convert old pdb files to a usable # # format. # # # ################################################ foreach my $pdb (@ARGV) { if ($pdb =~ /(.+?).pdb$/ && -e $pdb) { $pdb = $1; # $pdb = substr($pdb, 0, -4); open(IN, "<$pdb.pdb"); open(OUT, ">$pdb.tmp"); while(<IN>) { if ($_ =~ /^\S+\s+\d+\s+(\D)/) { my $line = $_; chomp($line); print OUT "$line $1\n"; } else { print OUT $_; } } close(IN); close(OUT); move("$pdb.pdb", "$pdb.pdb.old"); move("$pdb.tmp", "$pdb.pdb"); print "converted $pdb.pdb. the old file has been saved as $pdb +.pdb.old\n"; } elsif (! -e $pdb) { print "file $pdb does not appear to exist\n"; } else { print "file $pdb is not a .pdb file or there was an unknown er +ror\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help getting rid of taint
by graff (Chancellor) on May 14, 2009 at 03:00 UTC | |
by whollycow (Initiate) on May 14, 2009 at 13:32 UTC | |
by shmem (Chancellor) on May 14, 2009 at 14:14 UTC | |
|
Re: Need help getting rid of taint
by JavaFan (Canon) on May 13, 2009 at 22:44 UTC | |
by whollycow (Initiate) on May 13, 2009 at 23:00 UTC | |
by JavaFan (Canon) on May 13, 2009 at 23:18 UTC | |
|
Re: Need help getting rid of taint
by Anonymous Monk on May 14, 2009 at 04:52 UTC |