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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -