Take the 2-minute tour × print $_  But this works:    print $_;
Why doesn't the first version work?  share|improve this question
add comment  3 Answers  up vote 9 down vote accepted  Because
while (<>) is shorthand for while(defined($_ = <ARGV>)), but <>;
is just <ARGV>;. You can see this with the B::Deparse module.
Given the file example.pl   use strict; use warnings;   while
(<>) {  the command  perl -MO=Deparse example.pl  will print
use warnings; use strict 'refs'; example.pl syntax OK  This is
an example of Perl's famous DWIMery. I believe it was done to
stop people from doing the wasteful  for (<>) {  There is no
value to special casing <> in void context, and, in fact, it
would probably be harmful since when you say <>; you are most
often trying to throw away a line you don't want from the
filehandle. Having $_ catch it would not be efficient or
desirable.  share|improve this answer What does -MO mean? I can
find -M -O but not -MO.. –  new_perl Jul 27 '11 at 1:57
-Mmodule=arg1,arg2 is equivalent to