in reply to Store multiple match single line

What JavaFan said
perl -e ' $value = "12345654321"; @twos = ($value=~ /2/g);print "|", j +oin "|" , @twos,"\n";'
Or in the example you provide,
push @array, $1;
take a look at perlre

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: Store multiple match single line
by ambrus (Abbot) on Sep 24, 2010 at 12:48 UTC

    You mean this, right?

    $_ = "123patternABCpatternJJEK"; while ($_ =~ /(pattern)/gim) { push @array, $1; }
      I mean that

      print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."