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


in reply to Separating array contents

If there is no trailing delimiter, as in your posted text, you can do this:-

$ perl -Mstrict -Mwarnings -E ' my $str = q{!one ! two!three and four! five}; my @arr = reverse map { scalar reverse } split m{\s*!\s*}, scalar reverse $str; say qq{>$_<} for @arr;' >one< >two< >three and four< >five< $

If there is a trailing delimiter then you will still have the problem of an empty leading element so there would be no advantage to using this.

I hope this is of interest.

Cheers,

JohnGG