my @matches = ( $str =~ /pa(tt)ern/ )
For example:

perl -le ‘@m = ( “foo12gfd2bgbg654” =~ /(\d+)/g ); print for @m’

Gives the output:
12
2
654

http://stackoverflow.com/questions/2304577/how-can-i-store-regex-captures-in-an-array-in-perl

, ,
Trackback

no comment untill now

Sorry, comments closed.