I'm having a bit of trouble understanding why a csh command to source a file works fine from the command line but fails to work when incorporated into a Perl script.
my @envvar = ();
if (-e $ENV{WSDIR}."/<script>.csh") {
@envvar = `csh -c "cd $WSDIR ; source <script>.csh ; env"`;
}
When run I the Perl script I get an error as follows script.csh: No such file or directory, whereas running from the terminal as a csh command works as expected. What is the limitation on using environment variables in a csh command within Perl? How do I overcome this issue.
use strict; use warnings;! It would have caught this.