use warnings; use strict; my $test =",124,456,7890"; print "Test string: >$test<\n"; my @matches = split m/(,)/, $test; print "Item $_ is >$matches[$_]<\n" for 0..$#matches; #### Test string: >,124,456,7890< Item 0 is >< Item 1 is >,< Item 2 is >124< Item 3 is >,< Item 4 is >456< Item 5 is >,< Item 6 is >7890<