reedx032 has asked for the wisdom of the Perl Monks concerning the following question:
Dana
#!/usr/bin/perl -w use strict; my $oldarg; while (<>){ if ($ARGV ne $oldarg){ my $outputfile="out".$ARGV; open OUTPUT,">", $outputfile; $oldarg=$ARGV; } print OUTPUT "$_"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing the output filehandle while iterating input files.
by Perlbotics (Archbishop) on Sep 21, 2008 at 08:21 UTC | |
by ysth (Canon) on Sep 21, 2008 at 10:35 UTC | |
by betterworld (Curate) on Sep 21, 2008 at 10:52 UTC | |
|
Re: Changing the output filehandle while iterating input files.
by moritz (Cardinal) on Sep 21, 2008 at 08:27 UTC | |
|
Re: Changing the output filehandle while iterating input files.
by ambrus (Abbot) on Sep 21, 2008 at 08:57 UTC | |
|
Re: Changing the output filehandle while iterating input files.
by pjotrik (Friar) on Sep 21, 2008 at 13:55 UTC | |
|
Re: Changing the output filehandle while iterating input files.
by jwkrahn (Abbot) on Sep 21, 2008 at 11:57 UTC | |
|
Re: Changing the output filehandle while iterating input files.
by Anonymous Monk on Sep 21, 2008 at 08:31 UTC |