That code doesn't compile. TEST starts with double quotes and ends with a single quote. If I fix that, this works as expected for me. Here's a version you can run with your $x argument given on the command line:
use strict; my $x = shift(@ARGV); my $a = "TEST"; if ($x == 1) { $a = "one"; } elsif ($x == 2) { $a = "TWO"; } else { $a = "EMPTY"; } print "a=$a\n";
In reply to Re^2: The difference between my and local
by steves
in thread The difference between my and local
by cLive ;-)
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |