ajose has asked for the wisdom of the Perl Monks concerning the following question:
The above code works just fine. But I wonder there is any shorthand method to extract the same with a single line. I am aware of Win32::Process::List module which somehow not compatible with my Perl version. I tried using nested map which I am not able to get proper output. Any help is appreciated.my @tasks = `tasklist /FI "IMAGENAME eq perl.exe" /NH /FO CSV`; my @pids; foreach my $task (@tasks) { my @list = split /,/, $task; map {$_ =~s/"//g} @list; push @pids, $list[1]; } print "@pids";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Map and RegEx for data extraction
by jonadab (Parson) on Oct 14, 2014 at 10:42 UTC | |
|
Re: Using Map and RegEx for data extraction (sub)
by Anonymous Monk on Oct 14, 2014 at 10:32 UTC | |
|
Re: Using Map and RegEx for data extraction
by GotToBTru (Prior) on Oct 15, 2014 at 22:23 UTC |