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


in reply to How to split

Please help me in this... Say my code is as follows:...

FWIW, when we talk about "code" we usually mean "source code" as in "perl program", not about the data

Here is a start, run with it

#!/usr/bin/perl -- use strict; use warnings; my $blah = ' VAR DS 0D DC AL1(045),AL2(286),AL2(117),AL2(290)'; my ( $top, $bottom ) = split /[\r\n]+/, $blah; print "$top\n"; my( $prefix, @biscuits ) = grep length, split /[\s,]+/, $bottom; for my $tack ( @biscuits ){ print "$prefix $tack\n"; } __END__ VAR DS 0D DC AL1(045) DC AL2(286) DC AL2(117) DC AL2(290)