http://www.perlmonks.org?node_id=930641


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."