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