my $match = "mme"; my $word = "bummer"; my $seek_pos = 2; my $result; # one way: $result = ( index( $word, $match, $seek_pos ) == 0 ) ? "Got a match" : "Nada"; # another way: $result = ( index( $word, $match ) == $seek_pos ) ? "Got a match" : "Nada"; print "$result\n";
In reply to Re: Character matching in a word?
by graff
in thread Character matching in a word?
by ausag
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |