while($string =~ /(.)/g) { my $letter = $1; .... }