in reply to A another tr/// statement question..
in thread tr/// statement
(note the use of foreach, or and $! ...)@letter = qw/a b c w x y/; foreach $x (@letter) { $m = 0; open(DATA,"data.txt") or die "couldn't open data\n$!"; while (<DATA>) { $m += ($_ =~ s/$x/$x/g); } close(DATA); print "count $x = $m\n"; }
| Regards... | Stefan |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: A another tr/// statement question..
by supernewbie (Beadle) on Jul 19, 2001 at 16:46 UTC |