兰花仙子 wrote: > Hello, > > doesn't one-liner Perl command support __DATA__ handler? > Just found this: > > # perl -e 'while(<DATA>){ print } >> __DATA__ >> abc >> 123 >> def >> ' > > run without any output. >
$ perl -MO=Deparse -e 'while(<DATA>){ print } >> __DATA__ >> abc >> ' while (defined($_ = <DATA>)) { print $_; } __DATA__ -e syntax OK With the -e option, perl reads whatever follows as the script. The parser, however, stops reading when it reaches a line with __DATA__ or __END__. It ignores the rest. So when it runs, it thinks there nothing after the __DATA__. -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/