Hopefully this does not stray to close to What's wrong with using grep or map in a void context? but I thought this was an interesting, more readable way to see if a particular (sometimes complex) variable was equal to one of a number of values:
if( grep { $my->{long}{to}{type}{variable}[0] eq $_ } ( 'val1' +,'val2','val3' ) ) { #do something... }
In reply to Interesting Use of Grep by AidanLee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |