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


in reply to Separating array contents

split will work, join all the array cells together into one string, then split on the ! characters

Update: some Monks have rained on my parade by noting that this may produce empty elements. :-) You can filter out empty elements with map or grep -(see below)

my $string = join( '', @mycells); my @result = split( '!', $string); # remove empty elements, using something like.... my @finalResult = grep { $_ ne '' }, @result;
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)