Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Passing Variables

by rlb3 (Deacon)
on Oct 23, 2004 at 22:12 UTC ( [id://401895]=note: print w/replies, xml ) Need Help??


in reply to Passing Variables

Hello,

You may want to try something like this:

file: test.pl
#!/usr/bin/perl use strict; use warnings; use PackageName; our $shared = "Hello World!\n"; my $returnedValue = PackageName->routine(); print $returnedValue; __END__

file: PackageName.pm
package PackageName; sub routine { print $main::shared; return "Done\n"; } 1;
This maybe what your looking for.

rlb3

Replies are listed 'Best First'.
Re^2: Passing Variables
by hlen (Beadle) on Oct 23, 2004 at 22:17 UTC
    Or  $main::shared = "Hello World!\n";
Re^2: Passing Variables
by pg (Canon) on Oct 23, 2004 at 22:19 UTC

    However it is much more important to point out that, this is not the right thing to do.

    You are using mudules, but yet try to break the higher principles that "modules" meant to server.

Log In?
Username:
Password:

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

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

    No recent polls found