in reply to Re: counter of files? something else?
in thread counter of files? something else?
I am not sure why you are worried so much about counting files. If you have an array of files, perl will happily skip though them, one at a time, in order, using for. There is lots of stuff here though, that is not accounted for. You are not opening any files to read, $atomcount is a mystery. And the @atom array (probably better used at $atom[$p]) is also unmentioned before now.
But anyway, here is a go at wrangling your code a little. It probably won't compile, but may give you some useful hints. If you can post a more complete listing of your code, we may be able to help more
my @files = qw(file01 file02 file03 file04 file05); my $carboxyl = 0; # you may want to start at 1 instead for my $filename (@files) { open my $pdb, '>', "$filename.pdb"; my ($p, $w); my $bx = 50; # Never used again ? my $by = 50; # Never used again ? my $bz = 50; # Never used again ? print $pdb "\t%filename\n"; printf $pdb "%5d\n", $atomcount; for my $p (1 .. $atomcount) { # Perl likes to help printf $pdb "%5d%-5s%5s%5d%8.3f%8.3f%8.3f\n", 1,$carboxyl,@atom[$ +p],$p,@x[$p],@y[$p],@z[$p]; } $carboxyl++; printf $pdb "%10.5f%10.5f%10.5f\n",$bx,$by,$bz; close $pdb; }
is 'pdb' http://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format) ?
Cheers,
R.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: counter of files? something else?
by fasoli (Beadle) on Apr 23, 2015 at 13:49 UTC |