Steven Surgnier wrote:
Hi,

I desire a concise conditional statement which simply checks if each entry
in an array matches a given string.  For example:

print "all the same" if (grep {m/test_name/} @bins) == scalar @bins);

#END CODE

I thought, "grep will return the number of matches, so why not just check to
see if it equals the length of the array?"
I'm open to any suggestions even if it's merely cosmetic.

I would just write that as:

print "all the same" if @bins == grep /test_name/, @bins;



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to