For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > December 2006 > Comparing values.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Comparing values.
stuPeas

2006-12-18, 5:55 pm

ive got loads of comparisons to do and was wondering if there is a quicker way anyone can point me to.
If the array @match contains all the punctuation from a file, and i have to count occurances of each, then is there a short way.

this is what i will have to use for each character.


code:
foreach(@match){ if($_ eq '&'){ $ampersand++; } elsif($_ eq '$'){ $dollar++; } elsif(......etc..
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com