in reply to howto make a very long IF statment shorter
So long as the code inside the block doesn't depend on knowing which of the variables contained the match, just use grep.
if( grep( /abcdefg/, $foo, $bar, $baz ) ) { ## ... }
If you did need to know which one, then it gets more complicated. You could use a list of references (in which case you still wouldn't know which variable but you would have a means to diddle it), or you could stick things in a hash and use keys instead of variables.
|
|---|