WARNING: Once Perl sees that you need one of $&, $`, or $' anywhere in the program, it has to provide them for every pattern match. This may substantially slow your program. Perl uses the same mechanism to produce $1, $2, etc, so you also pay a price for each pattern that contains capturing parentheses. (To avoid this cost while retaining the grouping behaviour, use the extended regular expression "(?: ... )" instead.) But if you never use $&, $` or $', then patterns *without* capturing parentheses will not be penalized. So avoid $&, $', and $` if you can, but if you can't (and some algorithms really appreciate them), once you've used them once, use them at will, because you've already paid the price. As of 5.005, $& is not so costly as the other two. #### #!/usr/bin/perl use strict; use warnings; use 5.012; # 948541 my @arr = ; for $_(@arr) { if ( $_ =~ /([a-z 0-9\+\.]+?)(\d{0,3},{0,1}\d{0,3},{0,1}\d{1,3}) K/i ) { #1 my $processname = $1; my $memory = $2; say "$memory --- $processname"; } } #1 NB this regex allows for entries as small as 1K -- a condition # of which you might want to be aware. =head output: 1,788,180 --- disp+work.exe 3380 Console 0 2,787,204 --- sqlservr.exe 1768 Console 0 1,078,120 --- jlaunch.exe 4608 0 1,830,376 --- sqlservr.exe 1812 0 488,716 --- disp+work.exe 4772 0 17 --- proc 9412 Console 0 =cut __DATA__ disp+work.exe 3380 Console 0 1,788,180 K sqlservr.exe 1768 Console 0 2,787,204 K jlaunch.exe 4608 0 1,078,120 K sqlservr.exe 1812 0 1,830,376 K disp+work.exe 4772 0 488,716 K small_proc 9412 Console 0 17 K