develooper Front page | perl.perl5.porters | Postings from February 2015

[perl #123910] `undef $0;` does not work

Thread Next
From:
James E Keenan via RT
Date:
February 23, 2015 21:50
Subject:
[perl #123910] `undef $0;` does not work
Message ID:
rt-4.0.18-21846-1424728225-1807.123910-15-0@perl.org
On Mon Feb 23 13:18:26 2015, porton@narod.ru wrote:
> 
> This is a bug report for perl from porton@narod.ru,
> generated with the help of perlbug 1.40 running under perl 5.20.1.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> "Use of uninitialized value $0 in undef operator" is wrong.
> 
> $ cat z.pl
> print "$0\n";
> undef $0;
> $ perl -Mstrict -Mwarnings z.pl
> z.pl
> Use of uninitialized value $0 in undef operator at z.pl line 2.
> 


The documentation for $0 which you can read via 'perldoc perlvar' makes clear that assignment to $0 behaves in different ways on different operating systems.  I would therefore expect that 'undef'ing $0 would have a variety of results on different platforms.

Given that, it's not clear to me that the error message you got is really wrong.  After all, if you've undef-ed a variable, it then reverts to being uninitialized.

Can you be more specific about what you find problematic?

Thank you very much.


-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=123910

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