in reply to Capturing occurrence counts via tr/// with variable interpolation
$ans = eval "\$str =~ tr/$SrchStr/$SrchStr/"; die $@ if $@;
Update: If you want to count slashes, define $SrchString as '\/', or use a separator other than / for tr. Thanks to Corion for reminding me to point this out.
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Capturing occurrence counts via tr/// with variable interpolation
by ysth (Canon) on Aug 15, 2005 at 13:51 UTC | |
|
Re^2: Capturing occurrence counts via tr/// with variable interpolation
by Roger (Parson) on Aug 15, 2005 at 13:56 UTC |