Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Exec script within script or import sub...? help plz

by hbo (Monk)
on Jun 21, 2004 at 02:36 UTC ( #368355=note: print w/ replies, xml ) Need Help??


in reply to Exec script within script or import sub...? help plz

do will "do" this.
Two files, one named "priv" and one named "unpriv". Their contents:
priv:

sub priv { print "Privileged\n"; }

unpriv:
sub priv { print "Unprivileged\n"; }

Now, in your main program, you can:
#!/usr/bin/perl do "unpriv"; priv(); do "priv"; priv();

Which when run:
> perl main Privileged Unprivileged >


Comment on Re: Exec script within script or import sub...? help plz
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-07-04 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls