On 2011-07-19 21:23, Steven Surgnier wrote:

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);

Your match is not anchored, so ITYM:

  my $s = $bins[0];
  print qq{all '$s'} unless grep( $_ ne $s, @bins[1..$#bins]);

--
Ruud

--
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