http://www.perlmonks.org?node_id=997531


in reply to A small queestion to match processes

#obtain the length to match according to ps aux { print "#Enter the block just once\n"; last if $strindex; $strindex = index($_, "STAT"); #obtain how characters the RegEx should not match } #no more of this besides the first line

A simpler way to do that:

$strindex = $-[0] if ?STAT?;