Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: setting perl ENV from file

by halley (Prior)
on Sep 16, 2003 at 17:05 UTC ( [id://291879]=note: print w/replies, xml ) Need Help??


in reply to Re: setting perl ENV from file
in thread setting perl ENV from file

Assuming you have gotten $key and $value from the file, you could:
$value =~ s((\$\{(\w+)\}|\$(\w+))) ($ENV{$2} or $ENV{$3} or $1)eg;
This would support an input file with two possible interpolations:
key1=value key2=value$key1 key3=${key1}value
It depends on the order of definition. You could iterate the replacement step across all strings until the keys stop changing, but that may raise new problems.

--
[ e d @ h a l l e y . c c ]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found