just a small additional point in case you are not bored with cwd yet. and a question for perl command line flag devotees.
imagine i have a script, cwd.pl, whose location is
home/wufnik/scripts, and looks something like:
use Cwd;
print cwd . "\n";
then, as pointed out above, if i run this using:
/home/wufnik/scripts/cwd.pl, sitting in /home/,
/home will be printed as the current working directory.
exactly the same behaviour will be found if you use
the
perl -S cwd.pl
method of script invocation, ie: search through my $PATH,
which naturally contains /home/wufnik/scripts, for cwd.pl.
i also get this behaviour if i try running
perl -e 'print `perl -S cwd.pl`'
from /tmp, where it would print out: /tmp
i would like to know what happens when you use the perl -x flag, which
"switches to that directory before running the program". can't seem to get this to change to any directory on my win32 box, running cygwin, and the -h for perl gives: 'perhaps cd to directory'.
perhaps! is this a case of hubris in perl-the-app? do i have to be especially
good for this cd to take place? is the sense of mystery here designed to lend yet more allure to the perl command line? anyone use this flag before? if so, what does it do to cwd?
any enlightenment, even a wee bit, appreciated greatly...
wufnik
-- in the world of the mules there are no rules --