Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Difference between $0 and __FILE__

by BrowserUk (Pope)
on Sep 26, 2012 at 04:28 UTC ( #995694=note: print w/replies, xml ) Need Help??


in reply to Difference between $0 and __FILE__

Within a module (say a.pm) used from a program (say b.pl), __FILE__ will be a.pm but $0 will be b.pl.

The test you posted checks whether the file that contains it is being run as a 'main' program, or is being used or required, or done or eval'd.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995694]
help
Chatterbox?
marioroy enjoys reading Corion's ventures at the work place. Love your stories.
talexb adds his 'Ditto' to that thought.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2017-08-16 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (265 votes). Check out past polls.

    Notices?