The simplest solution of all would probably be to roll the functionality of your shell scripts into you perl code.

If you can't do the above, then it may be that you're not familiar with (or haven't considered) piping, which might be a good choice for the other-than-environment-variables that need exported to your perl script.

If you are familiar with piping, please ignore the rest of this response. It's real newbie stuff.

There is a short tutorial on piping here.

As an example, lets say that your shell script outputs the lines:

fee fi fo fum

A perl script that is expecting piped input would look something like:

#!/usr/bin/perl -w use strict; while (<STDIN>) { print uc($_); }

If I then 'piped' the output of my shell script into my perl script with a command like
giant.sh | caps.pl
my perl scipt, caps.pl, would print the following to STDOUT:

FEE FI FO FUM

This is a very trivial example. It would be much better to have your shell scripts print identifiers for each line so that there is no question about what line belongs to what other-than-environment variable.


In reply to Re: enviorment by Art_XIV
in thread Importing environment variables from shell script file to Perl by bugsbunny

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.