Save regular expression in an array in perl

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

, ,

Writing Regular Expressions of perl in easy way

Check It Out~

http://www.weitz.de/regex-coach/

some reference for regular expressions:

http://www.sdsc.edu/~moreland/courses/IntroPerl/docs/manual/pod/perlre.html

, , , ,