-----Original Message-----
>From: neo80123 <[EMAIL PROTECTED]>
>Sent: Aug 21, 2007 10:01 PM

>The input is sth like that "51,34,55,45.0" or "34,45,123,55,0". I want
>to find out how often Number 55 exists. No matter on what position the
>55 is.
>

Hello,

Use a hash to count the numbers.Like,

$ perl -e '
$str="55,551,34,55,45.0";
$hash{$_}++ for split/,/,$str;
print $hash{55}'

--
Jeff Pang - [EMAIL PROTECTED]
http://home.arcor.de/jeffpang/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to