in reply to Counting number of double quotes in a string
As you can see, you're doing $pos = (index() != -1), where you want to do ($pos = index()) != -1. This problem causes $pos to be 1 all the time!friday:~ $ perl -MO=Deparse,-p -e '1 while $x = $y != $z' -e syntax OK '???' while ($x = ($y != $z));
I have a better idea. Use the tr/// operator. $count += tr/"// while <FILE>;
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Counting number of double quotes in a string
by arajani (Novice) on May 13, 2002 at 16:54 UTC |