basm100 has asked for the wisdom of the Perl Monks concerning the following question:
why doesn't this work ? I want the number of A's in the line to be stored in Acount. Thanks for your help, basm100while(<MYFILE>) { $line=<MYFILE> $Acount =($line=~tr/A//); #to count no. of A's in a line #if I then print $Acount it says 0 even if there are A's in the line ! }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Counting using transliteration
by jmcnamara (Monsignor) on Feb 25, 2002 at 11:34 UTC | |
by demerphq (Chancellor) on Feb 25, 2002 at 12:05 UTC | |
|
Re: Counting using transliteration
by Ido (Hermit) on Feb 25, 2002 at 12:16 UTC | |
|
Re: Counting using transliteration
by Dog and Pony (Priest) on Feb 25, 2002 at 12:17 UTC | |
by basm100 (Novice) on Feb 25, 2002 at 14:06 UTC | |
by zengargoyle (Deacon) on Feb 26, 2002 at 01:33 UTC | |
|
Re: Counting using transliteration
by trs80 (Priest) on Feb 25, 2002 at 18:12 UTC |