Peter Daum schreef:
> my $x = undef;
> foreach ( qw(a b c) ) {
> my $t = $x if $x;
> warn( "\$t == ", $t||'undef', "\n" );
> $t = $_;
> }
>
> $t would be initialized with the value of $x if that was true;
> otherwise (at least that's what I would expect) $t should be
> undefined,
> so
Chas. Owens wrote:
On Jan 13, 2008 1:20 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
Statements don't define scope, braces and files define scope.
snip
so why should you be able to use it because it has been changed to this
my $t = $x if $x;
print "$t\n";
You can use it because it is i
On Jan 13, 2008 1:20 PM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> Statements don't define scope, braces and files define scope.
snip
> > so why should you be able to use it because it has been changed to this
> >
> > my $t = $x if $x;
> > print "$t\n";
>
> You can use it because it is in th
Chas. Owens wrote:
On Jan 13, 2008 6:22 AM, Peter Daum <[EMAIL PROTECTED]> wrote:
snip
my $t =$x if $x;
snip
$t would be initialized with the value of $x if that was true;
otherwise (at least that's what I would expect) $t should be undefined,
so the result would be as before. The real out
On Jan 13, 2008 6:22 AM, Peter Daum <[EMAIL PROTECTED]> wrote:
snip
> my $t =$x if $x;
snip
> $t would be initialized with the value of $x if that was true;
> otherwise (at least that's what I would expect) $t should be undefined,
> so the result would be as before. The real outcome, however, i
Peter Daum wrote:
Hi,
Hello,
I just got bitten by a very simple issue, where Perl behaves totally
different from what I had expected;
According to the documentation, lexical variables are visible only after
the line they have been declared in; they may be initialized;
otherwise their value i