It looks like you want something like this:
#!/usr/bin/perl use warnings; use strict; while ( <> ) { if ( $. == 1 ) { open OUTPUT '>', "out$ARGV" or die "Cannot open out$ARGV: $!"; } print OUTPUT; close ARGV if eof; }
In reply to Re: Changing the output filehandle while iterating input files.
by jwkrahn
in thread Changing the output filehandle while iterating input files.
by reedx032
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |