Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: System() in list mode?

by anneli (Pilgrim)
on Oct 18, 2011 at 21:00 UTC ( #932244=note: print w/ replies, xml ) Need Help??


in reply to Re^2: System() in list mode?
in thread System() in list mode?

Alright.

Here I'm prepending $HOME/dir to PATH, and executing a program named "program name", which happens to be in /home/anneli/dir (i.e. the path I prepended):

$ pwd /home/anneli $ ls -F ./dir/ program name* $ cat dir/program\ name #!/usr/bin/env perl print "It works!\n"; $ cat eg.pl system('env', "PATH=$ENV{HOME}/dir:$ENV{PATH}", 'program name'); $ perl eg.pl It works! $

I hope this helps. We do the necessary expansion of HOME and PATH on our side, before sending them through to the (non-expanding) multi-argument system call.

Anne


Comment on Re^3: System() in list mode?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2015-07-04 13:51 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 (60 votes), past polls