469,916 Members | 2,147 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,916 developers. It's quick & easy.

How to source variables and values from a file, like in UNIX sh scripts?

In e.g. a Bourne shell script I can source variables and values;
#!/bin/sh
.. ${HOME}/script_common_lib

How can I source variables and values from a file
and use them in Perl-scripts?

Perl-"pseudo code":
...
source("${HOME}/script_common_lib");
$logfile = $A_LOG_FILE;
...
print "Log file name: ", $logfile;
...

And in the file '${HOME}/script_common_lib' contains e.g.:
...
export A_LOG_FILE=/tmp/foo.log
...

Best Regards,
Ronnie
Jul 19 '05 #1
1 2015
Ronnie Laurikkala wrote:
How can I source variables and values from a file
and use them in Perl-scripts?


Depending on what you want to do:
perldoc - f use
perldoc -f do
perldoc -f require

jue
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Mark Hannon | last post: by
7 posts views Thread by Nicole | last post: by
7 posts views Thread by chakkaradeepcc | last post: by
9 posts views Thread by Sathyaish | last post: by
135 posts views Thread by Xah Lee | last post: by
2 posts views Thread by Dr. Who | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.