in reply to What I Most Recently Learned in Perl, But Should Have Already Known
When writing that loop explicitly I would be testing it like this:while (<>) { }
It turns out that is exactly what perl is doing as well, as seen below:while (defined( my $line = <>)) { }
It's also interesting to see what the parser thinks about other code, such as:perl -MO=Deparse -e 'while (<>) {}' while (defined($_ = <ARGV>)) { (); }
Andperl -MO=Deparse -e ' if(1) {print "true"}' do { print 'true' };
And it is useful for seeing what some of the code from the Obfuscation section is actually doing.perl -MO=Deparse -e ' print "true" if 1' print 'true';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What I Most Recently Learned in Perl, But Should Have Already Known
by Hue-Bond (Priest) on Aug 21, 2006 at 10:55 UTC | |
by pKai (Priest) on Aug 23, 2006 at 09:36 UTC | |
|
Re^2: What I Most Recently Learned in Perl, But Should Have Already Known
by liverpole (Monsignor) on Aug 21, 2006 at 11:25 UTC | |
|
Re^2: What I Most Recently Learned in Perl, But Should Have Already Known
by Freddo (Acolyte) on Mar 17, 2007 at 10:33 UTC |