use strict; use warnings; foreach my $num_string ('0000'...'9999') { my($i,$j,$k,$l) = split (//,$num_string); print "i=$i j=$j k=$k l=$l\n"; }