in reply to Where automatic variable $_ doesn't work?

Hi guiwp,

It's not "prohibited": How should Perl tell the difference between print $fh; and print $fh;? With the first one I meant "print the value of $fh to the currently selected filehandle" and with the second one I meant "print $_ to the filehandle $fh"? That's taking DWIM a little too far ;-)

Regards,
-- Hauke D

Replies are listed 'Best First'.
Re^2: Where automatic variable $_ doesn't work?
by guiwp (Sexton) on Jul 04, 2016 at 20:23 UTC

    I always thought Perl was taking DWIM a little too far! I assume the compiler (and the human that made it!) is pretty smart =)

    Thank you @haukex