L
levinepw
Hi,
This code does not work:
----------------------------------------------
my $color='red';
if($color eq ('blue' || 'red' || 'green'))
{
print "cool\n";
}
----------------------------------------------
I wanted a shorthand to
my $color='red';
if($color eq 'blue' || $color eq 'red' || $color eq 'green'))
{
print "cool\n";
}
Can someone tell me why my attempt doesn't work & if there is a
simpler way to write the statement.
Thanks
This code does not work:
----------------------------------------------
my $color='red';
if($color eq ('blue' || 'red' || 'green'))
{
print "cool\n";
}
----------------------------------------------
I wanted a shorthand to
my $color='red';
if($color eq 'blue' || $color eq 'red' || $color eq 'green'))
{
print "cool\n";
}
Can someone tell me why my attempt doesn't work & if there is a
simpler way to write the statement.
Thanks