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;