Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Using IF and OR, I'm sure there is a better way

by monarch (Priest)
on Dec 15, 2005 at 04:22 UTC ( [id://516851] : note . print w/replies, xml ) Need Help??


in reply to Re: Using IF and OR, I'm sure there is a better way
in thread Using IF and OR, I'm sure there is a better way

This unfortunately is significantly longer to execute than the boolean OR. The grep has to test every value, whereas the if statement uses short-circuit boolean logic to stop testing values as soon as a match is found.

Replies are listed 'Best First'.
Re^3: Using IF and OR, I'm sure there is a better way
by ysth (Canon) on Dec 15, 2005 at 08:48 UTC
    "significantly"? Maybe a significant factor longer, but if the OP was even considering writing it in a long || ... || ... ||, there aren't enough elements to make it significant in absolute terms.