in reply to unix loops in perl

Simply use a loop in Perl:

for my $c (1..24) { my $filename = "chr$c"; open my $IN, '<', $filename or die "Cannot open '$filename' for re +ading: $!"; open my $OUT, '<', "$filename.out" or die "Cannot open '$filename. +out' for writing: $!"; while (my $line = <$IN>) { ... } close $IN; close $OUT; }

Replies are listed 'Best First'.
Re^2: unix loops in perl
by a217 (Novice) on Oct 26, 2011 at 05:56 UTC

    Thank you. I tried using perl loops before, but I must have gotten the syntax wrong so I just stopped trying. But I knew it was just a simple problem I was overlooking.