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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ronnie Laurikkala

    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_l ib

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

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

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

    Best Regards,
    Ronnie
  • Jürgen Exner

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

    Ronnie Laurikkala wrote:[color=blue]
    > How can I source variables and values from a file
    > and use them in Perl-scripts?[/color]

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

    jue


    Comment

    Working...