defined() confusion
From: Chris (bit_bucket5_at_hotmail.com)
Date: 12/11/03
- Previous message: Alex Zeng: "Re: Read one character of input?"
- Next in thread: Alex Zeng: "Re: defined() confusion"
- Reply: Alex Zeng: "Re: defined() confusion"
- Reply: nobull_at_mail.com: "Re: defined() confusion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 11 Dec 2003 10:14:32 -0800
This seems inconsistent:
#!/usr/bin/perl -w
use strict;
my @y;
if(!defined(@y))
{
print "y undefined\n";
}
my $z = scalar(@y);
if(!defined($z))
{
print "z undefined\n";
}
if(!defined(scalar(@y)))
{
print "scalar(\@y) not defined\n";
}
This prints
y undefined
scalar(@y) not defined
So, the question is, why does
my $z = scalar(@y);
if(!defined($z))
behave differently from
if(!defined(scalar(@y)))
???
Thanks,
Chris
- Previous message: Alex Zeng: "Re: Read one character of input?"
- Next in thread: Alex Zeng: "Re: defined() confusion"
- Reply: Alex Zeng: "Re: defined() confusion"
- Reply: nobull_at_mail.com: "Re: defined() confusion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]