in reply to Storing more than one regexp match in a line

#!/usr/bin/perl $_="1 2 blue 4 yellow orange 6 7 yello purple ellow"; my @matches=/(\w*ello\w*)/g; foreach my $one (@matches) { print "[$one]\n"; }

results in:

$ perl tester [yellow] [yello] [ellow]
Update:removed useless parens around @matches. duh. thanks Albannach.

Update 2: Perhaps some text from perlfunc would help explain what's happening:

The /g modifier specifies global pattern matching--
that is, matching as many times as possible within
the string.  How it behaves depends on the context.
In list context, it returns a list of all the
substrings matched by all the parentheses in the
regular expression.