Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > How to source variables and values from a file, like in UNIX sh scripts?

Reply
Thread Tools

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

 
 
Ronnie Laurikkala
Guest
Posts: n/a
 
      12-18-2003
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
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      12-18-2003
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
Pop-up gives old values - like memory is not cleared and same values keep appearing chris ASP .Net 0 10-13-2006 11:57 AM
compile C programs with UNIX system calls (= Unix Programs??) jrefactors@hotmail.com C Programming 18 01-10-2005 03:35 AM
compile C programs with UNIX system calls (= Unix Programs??) jrefactors@hotmail.com C++ 12 01-10-2005 03:35 AM
my own perl "dos->unix"/"unix->dos" Robert Wallace Perl Misc 7 01-22-2004 10:59 PM



Advertisments