my $string = '123456789012345'; my %counts ; $counts{ $_ }++ for split //, $string; foreach my $char ( keys %counts ){ if( $counts{ $char } > 1 ){ print "$char is not unique in $string\n"; }else{ print "$char is unique in $string\n"; } }
In reply to Re: Unique character in a string?
by duckyd
in thread Unique character in a string?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |