in reply to Convert Shell script to Perl
You could set the environment variables and run exec to call the script
[skrynesaver@busybox ~]$ cat ~/tmp/test.pl #!/usr/bin/perl $ENV{'THE_VAR'}= "This has been set in the environment of the script"; exec "$ENV{HOME}/tmp/test.sh" [skrynesaver@busybox ~]$ cat ~/tmp/test.sh #!/bin/bash echo $THE_VAR [skrynesaver@busybox ~]$ perl tmp/test.pl This has been set in the environment of the script
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Convert Shell script to Perl
by cdarke (Prior) on Oct 10, 2011 at 14:41 UTC | |
by akrrs7 (Acolyte) on Oct 10, 2011 at 15:26 UTC | |
by Utilitarian (Vicar) on Oct 10, 2011 at 15:43 UTC | |
Re^2: Convert Shell script to Perl
by akrrs7 (Acolyte) on Oct 10, 2011 at 14:15 UTC | |
by Anonymous Monk on Oct 10, 2011 at 14:20 UTC | |
by akrrs7 (Acolyte) on Oct 10, 2011 at 15:11 UTC | |
by eyepopslikeamosquito (Archbishop) on Oct 10, 2011 at 19:28 UTC | |
Re^2: Convert Shell script to Perl
by akrrs7 (Acolyte) on Oct 10, 2011 at 15:46 UTC | |
by FreeBeerReekingMonk (Deacon) on Mar 01, 2016 at 20:10 UTC |
In Section
Seekers of Perl Wisdom