Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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: (13)
As of 2014-07-23 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (149 votes), past polls