Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2017-02-20 07:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (294 votes). Check out past polls.