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


in reply to Re^2: accessing the result of a match as an array
in thread accessing the result of a match as an array

What's the advantage of your latter snippet over

perl -e '"hello awesome" =~ /(el).*(om)/ and print $2;'
or, if you don't like to count,
perl -e '"hello awesome" =~ /(el).*(om)/ and print $^N;'

By the way, while I'm nattering about linking, [doc://perlvar#%-] (but not [doc://perlvar#%25-], which over-escapes) facilitates the OP's laziness: % .

UPDATE: It seems to me that the link text for [doc://perlvar#%-] should be '%-', but it's actually '% '. Is this a bug? (Oops, that's right: - is parsed as a word separator, as in [doc://perlrun#Location-of-Perl].)