in reply to Re: The difference between my and local
in thread The difference between my and local
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";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: The difference between my and local
by sanPerl (Friar) on Oct 17, 2006 at 11:28 UTC | |
by davorg (Chancellor) on Oct 17, 2006 at 11:54 UTC | |
by shmem (Chancellor) on Oct 17, 2006 at 11:40 UTC | |
by ikegami (Patriarch) on Oct 17, 2006 at 15:11 UTC | |
by Nazeerahamed (Initiate) on Oct 06, 2012 at 16:15 UTC | |
by Anonymous Monk on Apr 15, 2018 at 04:32 UTC |
In Section
Tutorials