Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: while(<>) { ... } considered harmful (...= require ...)

by tye (Sage)
on Aug 18, 2003 at 21:44 UTC ( #284738=note: print w/replies, xml ) Need Help??


in reply to Re: Re: while(<>) { ... } considered harmful
in thread while(<>) { ... } considered harmful

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.

                - tye

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://284738]
help
Chatterbox?
[oiskuu]: Someone needs to re-read How do I use the power of consideration responsibly? carefully. Consideration is not intended for stamping out humor, AFAIK.
[oiskuu]: E.g. Re^3: Big thank you to the Perl community. is surely dry humor (not mine). Don't they teach humor in german schools!?
[LanX]: you don't see the whole picture
[LanX]: But reu germans have no humor, better to refrain from this site till the troll is gone...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2017-04-27 19:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (512 votes). Check out past polls.