Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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?
[marto]: Corion yes I saw them Pandemonium_Tour
[Corion]: marto: Yeah, and I doubt that they'll ever get back to something like Violator/Songs of Faith and Devotion - it would either alienate their "regular" crowd, or be "too much Violator" ;)
LanX needs to see Freddy Mercury'
[Corion]: marto: Yeah, I have that on DVD even, and I missed them last year because I was in London at the time ironically ;)
[marto]: put me in the mood to listen to this now :)
[Corion]: LanX: Well, grab a shovel :)
[Corion]: Kraftwerk also are still touring (well, only Ralf Hütter and Florian Schneider), but I'm too tight fisted to spend EUR 150+ for standing around two hours ;)
[Corion]: Oh. Queen have a new front man. Not really sure...
[marto]: Florian retired some years ago. I have been gifted a ticket to their show in Glasgow as my friends husband can no longer make it
[Corion]: marto: Ah, so it's only one original remaining, and his clones ;)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-03-24 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.