I used the filehandle DATA as a convenient way to include some test lines in a Simple, Self Contained Example. You can either do as markong suggested and populate an array with your output
my @output = `bpdbjobs`; #while (<DATA>){ for (@output) { # process lines }
or if you have the output in a text file, open a filehandle to that
my $filename = 'output.txt'; open my $fh,'<',$filename or die "Could not open $filename : $!"; while (<$fh>){ # process lines }
or you may be able to pipe the output directly from your program. see Calling External Commands More Safely
Updated ; last example corrected backticks to single quote pojopen my $fh, '-|', 'bpdbjobs' or die $!; while (<$fh>){ # process lines } close $fh or die $! ? $! : $?;
In reply to Re^5: Turning regex capture group variables into arrays, then counting the number of objects in the array
by poj
in thread Turning regex capture group variables into arrays, then counting the number of objects in the array
by Djay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |