Operating System - HP-UX
1752688 Members
5539 Online
108789 Solutions
New Discussion юеВ

Re: ksh script with perl command

 
SOLVED
Go to solution
Lorenzo Santacana
Occasional Contributor

ksh script with perl command

Hi,

I have a ksh script that calls a perl command. Inside this perl command I need to use a variable defined in the ksh script.

The perl command inside the ksh script is:

otime=`perl -e '
use Time::Local;
print timelocal(<script_variable>),"\n"
'`

What I need is to use a variable defined inside the script as a parameter for the timelocal function.

How can I do that?

Many thanks,
Lorenzo
3 REPLIES 3
harry d brown jr
Honored Contributor
Solution

Re: ksh script with perl command


[root@vpart1 /etc/named.data]# export CRAZY=2004
[root@vpart1 /etc/named.data]# perl -e 'printf("Here is CRAZY %s\n.",$ENV{"CRAZY"});'
Here is CRAZY 2004
.[root@vpart1 /etc/named.data]#


man perlfunc


live free or die
harry d brown jr
Live Free or Die
Lorenzo Santacana
Occasional Contributor

Re: ksh script with perl command

Many thanks, harry.

It works perfectly!!
H.Merijn Brand (procura
Honored Contributor

Re: ksh script with perl command

Just as a side note, use modules have command line option support

# perl -MTime::Local -le'print timelocal $ENV{VARIABLE}'

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn