in reply to Extract lines and output...
foreach( @files ) { my $outfile = outfile_name( $_ ); open( CUR, $_ ) or die "open $_: $!\n"; open( OUT, ">$outfile" ) or die "open $outfile: $!\n"; print OUT $_, "\n"; while( <CUR> ) { last if $. > 4; print OUT; } close( OUT ); close( CUR ); } sub outfile_name { my $base = shift; return $base . "_distilled" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Extract lines and output...
by belden (Friar) on Oct 10, 2001 at 07:51 UTC | |
by tachyon (Chancellor) on Oct 10, 2001 at 08:17 UTC | |
by broquaint (Abbot) on Oct 10, 2001 at 13:42 UTC | |
by belden (Friar) on Oct 10, 2001 at 08:58 UTC | |
by tachyon (Chancellor) on Oct 10, 2001 at 11:10 UTC |