Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: use, require, do or what?

by moritz (Cardinal)
on Jul 30, 2008 at 18:52 UTC ( [id://701229]=note: print w/replies, xml ) Need Help??


in reply to use, require, do or what?

It doesn't work because $variable1 is only known in your client file, not in the library.

The solution is to encapsulate the code in the library into a subroutine, and call that:

require "./Library.pl"; my $variable1 = sub_from_library(); print "$variable1\n";

Even better: make the library a module, and then use it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://701229]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-23 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found