Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 >

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 pondering the Monastery: (4)
As of 2016-09-27 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (494 votes). Check out past polls.