Axel and Wayne- Thank you both on the prompt replies.
I was thinking that the test would work because it would query the environment. What i was missing is that it skips that for testing existence. Thank you. =o) -a more learned Josh "Axel Mock" <[EMAIL PROTECTED]> 06/08/2006 01:10 PM To [EMAIL PROTECTED] cc [email protected] Subject Re: attempting to understand an unexpected response from existence testing Hi Josh, maybe if you change %systemdrive% (a BATch file variable) to $ENV{'systemdrive'}, the first code snippet might run as well. Or : what is %systemdrive% for PERL??? In this case : the string "%systemdrive%", so the -e is looking for a path starting with (literally) %systemdrive% which normally does not exist.... Regards, Axel > I am trying to expand my understanding of perl. i do not understand why > the first test fails and the latter two succeed. shouldn't the first > succeed as well? > > #!/usr/bin/perl > use strict; > > # doesn't work > if(-e "%systemdrive%\\servicedisk\\tools\\seachange\\SeaPatch.exe"){ print > "yes\n"; }else{ print "no\n"; } > > # work on either versions > > my $sysdir=`%systemdrive%`; > my $file ="$sysdir\\servicedisk\\tools\\seachange\\SeaPatch.exe"; > if(-e $file){ print "yes\n"; }else{ print "no\n"; } > if(-e "$sysdir\\servicedisk\\tools\\seachange\\SeaPatch.exe"){ print > "yes\n"; }else{ print "no\n"; } > > ----------------------------------------- > > > _______________________________________________ > ActivePerl mailing list > [email protected] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ---------------------------------------------------------------------- S y s K o n n e c t G m b H A Marvell Company Siemensstr. 23 D-76275 Ettlingen ---------------------------------------------------------------------- Axel Mock Software Engineer phone: +49 7243 502 319 fax: +49 7243 502 931 email: [EMAIL PROTECTED] http://www.syskonnect.de ----------------------------------------------------------------------- ----------------------------------------- _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
