perl -e ' for $i (0..3) { $sub = "xxx"; $par = "xxx " x $i; $count = () = $par =~ /\Q$sub\E/g; $msg = qw( none one duplicates ) [ $count<2 ? $count : 2 ]; print $msg,"\n"; }' none one duplicates duplicates
Cheers Rolf
In reply to Re: Counting SubStrings, Style Question
by LanX
in thread Counting SubStrings, Style Question
by se@n
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |