http://www.perlmonks.org?node_id=467001


in reply to Re: $^W or require warnings and import warnings;
in thread $^W or require warnings and import warnings;

Good call, this definitely doesn't work the way the author intended. I wondered the same thing initially and tried something eerily similar to your code, but it seemed to warn me on both print statements. When I read your post I was definitely surprised for a few seconds, until I looked at the top of my script and found this:
#!/usr/bin/perl -w
So, removing the -w gave me the output you describe.

I use perl -w in most of my scripts, so it's in my VIM template for Perl scripts. Further proof that it's important to remember your coding habits, lest they sneak up on you when you least expect it. :)