in reply to Inserting elements into arrays

It might be easier to just assign the result value to the array:
my @array = $text =~ /pattern/g;
This assumes the pattern doesn't contain parens though.