because grep returns in scalar context the number of matches
DB<13> @a= ('string') x 5 DB<14> x @a 0 'string' 1 'string' 2 'string' 3 'string' 4 'string' DB<15> print @a == grep { 'string' eq $_ } @a 1 # true DB<16> push @a, 'nope' DB<17> print @a == grep { 'string' eq $_ } @a # false DB<18>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re: Comparing multiple strings
by LanX
in thread Comparing multiple strings
by bigup401
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |