Trying to disable some variables in Perl, and the following code works fine:
if ($year =~ /^(\d{4})$/) { $year = $1; } else { &invalid("year"); }
In the above example, $ 1 contains $ year, if valid. However, when using the ?:
$ 1 operator, it contains "1" if it is valid:
($year =~ /^(\d{4})$/) ? $year = $1 : &invalid("year");
Does anyone see where I can be to blame? I am confused why this is happening. This only happens on this machine. More truly, I successfully used? operator to return the correct matching variables for many years. I have not tried this piece of code on any other machine yet.
This is Perl, v5.8.8 built for x86_64-linux-thread-multi
source share