- or download this
#!/usr/bin/perl
use strict;
...
} elsif (my $x = 2) {
#
}
- or download this
"my" variable $x masks earlier declaration in same scope at test.pl li
+ne 9 (#1) (W misc) A "my" or "our" variable has been redeclared in th
+e current scope or statement, effectively eliminating all access to t
+he previous instance. This is almost always a typographical error.
+Note that the earlier variable will still exist until the end of the
+scope or until all closure referents to it are destroyed.
...
if ($foo == 123)
(or something like that).
- or download this
#!/usr/bin/perl
use strict;
...
}
sub get_num { 3 }
- or download this
if ( (my $x = get_num()) >= 3 ) {
...
}
- or download this
my $x = get_num(); # assumed to always returns a number
if ($x < 0 ) {
...
} else {
# OK
}