perl - Print sysout lines at single go from open 3 -
i using open 3 , printing lines below 1 one after doing parsing. not want print line line want store , print @ once how can it?
while(my $nextline=<handle_out>) { chomp($nextline); if ($nextline =~ m!<bea-!){ print "skipping line (bea): |$nextline|\n" if $debug; } print $nextline."\n"; }
if don't want lines printed while you're looping on file handle, this:
the data structure being hash of anonymous arrays( debug , output ).
my %handle_output = ( debug => [], output => [], ); while(my $nextline=<handle_out>) { chomp($nextline); if ($nextline =~ m!<bea-!){ push( @{$handle_out{debug}}, $line ) if $debug; } else { push @{$handle_output{output}}, $line; } } $line ( @{$handle_output{output}} ) { print $line . "\n"; }
Comments
Post a Comment