my $var = 'the quick brown fox'; while( $var =~ m/(.)/g ) { print "Matched '$1' \@ pos:", pos($var), "\n"; }