require returns the last evaluated expression in the file
Only the first time:
> perl -de 0 ... DB<1> x require 'con' 'this is true'; ^Z 0 'this is true' DB<2> x require 'con' 0 1 DB<3> x require 'con' 0 1 DB<4>
I've seen people do wacky things like have "return %hash" as the last expression and do "%hash = require Foo::Bar";
So such code will break as soon as more than one use of the module is attempted from a single run. That's a bit of a shame too, since Perl could really use something along those lines.
- tyeIn reply to Re^3: while(<>) { ... } considered harmful (...= require ...)
by tye
in thread while(<>) { ... } considered harmful
by IlyaM
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |