# Get all the positions my @positions; push @positions, pos($str)-1 while $str =~ m{\*}g; # Yields ( 4, 12 );