On Fri, 22 Jun 2001, Tim Musson wrote:
> Is this a better way?
>
> if (($Var eq "String") || ($Var2 =~ /$STRING/)) {
> &Sub($Var1);
> }
I usually write...
if ($Var eq "String" or $Var2 =~ /$STRING/) {
...as I like the diffrent precidence of the 'or' operator.
You can also leave off the & if you are using Perl 5.
As to if it is a better way... I would say yes because it
probably saves a CPU cycle or two, and you reduce the chance
of editing errors by not having duplicate code that can be
a pain to maintain.
--
Ian