[sf-perl] Embedded Perl in a Korn shell program

Loo, Peter # PHX Peter.Loo at source.wolterskluwer.com
Fri May 11 14:57:37 PDT 2007


Yes, thank you all very much once again.
 
Peter

-----Original Message-----
From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org
[mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or
g] On Behalf Of Quinn Weaver
Sent: Friday, May 11, 2007 2:34 PM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] Embedded Perl in a Korn shell program

On Fri, May 11, 2007 at 02:10:22PM -0700, Loo, Peter # PHX wrote:
> Hi All,
>  
> I am trying to add a day to a date using Perl Time::Local library 
> within a Korn shell.  However it is not allowing my Korn shell 
> variable to be used within the Perl command.

One more thing:  you need to "export" your shell variables into the
environment in order for Perl to see them.  Otherwise the variables are
private to your shell.  For instance:

    DD=foo
    export DD
    perl -e 'use strict; use warnings; print "$ENV{DD}\n"';

That will output

    foo

But if you don't export...

    DD=foo
    perl -e 'use strict; use warnings; print "$ENV{DD}\n"';

You'll get this error message:

    Use of uninitialized value in concatenation (.) or string at -e line
1.

Because $ENV{DD} is undefined.

HTH.  When you move your Perl code to a separate file, remember to turn
on

    use strict;
    use warnings;

--
Quinn Weaver, independent contractor  |  President, San Francisco Perl
Mongers
http://fairpath.com/quinn/resume/     |  http://sf.pm.org/
_______________________________________________
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
http://mail.pm.org/mailman/listinfo/sanfrancisco-pm


This E-mail message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not
the intended recipient, please contact the sender by reply E-mail, and
destroy all copies of the original message.


More information about the SanFrancisco-pm mailing list