my $str = '1029576843'; my @f = split //, $str; for (@f) { #$_ is now 0; next run will be 1 and so on print; } #or for my $current_number (@f) { #$current_number is now 0; next run will be 1 and so on print $current_number; }