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

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

Thread Next
James E Keenan via RT
February 23, 2015 21:50
[perl #123910] `undef $0;` does not work
Message ID:
On Mon Feb 23 13:18:26 2015, wrote:
> This is a bug report for perl from,
> 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
> print "$0\n";
> undef $0;
> $ perl -Mstrict -Mwarnings
> Use of uninitialized value $0 in undef operator at 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 (

via perlbug:  queue: perl5 status: open

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About