If you want to determine if a given character is unique then you could use
if( $var =~ m[1] and $var !~ m[1.*1] ) { ## $var contains exactly one '1' character. }
Alternatively, if you want to know if the string contains no duplicates of any character then
if( $var !~ m[(.).*\1] ) { ## $var contains no duplicate characters }
In reply to Re: Unique character in a string?
by BrowserUk
in thread Unique character in a string?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |