develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [PATCH pod/perlfunc.pod] ref can return false on references

Thread Previous | Thread Next
From:
schwern
Date:
October 6, 2003 12:44
Subject:
Re: [PATCH pod/perlfunc.pod] ref can return false on references
Message ID:
20031006124408.D20960@ttul.org
On Mon, Oct 06, 2003 at 05:06:55PM +0100, Nick Ing-Simmons wrote:
> Abigail <abigail@abigail.nl> writes:
> >The first sentence of 'perldoc -f ref' is wrong:
> >
> >    Returns a true value if EXPR is a reference, false otherwise.
> >
> >To wit:
> >
> >    $ perl -wle 'print ref bless [] => 0'
> >    0
> 
> I would be tempted to make that bless illegal.

I second that tempation.  If the above is legal then this very common idiom
is no longer correct:

    print "$r is not a reference" unless ref $r;

And I'm not about to go around patching everything to say:

    print "$r is not a reference" unless length ref $r;

just so someone can have their Acme module.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About