$Bill Luebkert wrote:
> Bowie Bailey wrote:
>
> > [EMAIL PROTECTED] wrote:
> >
> > > > # doesn't work
> > > > if(-e
> > > > "%systemdrive%\\servicedisk\\tools\\seachange\\SeaPatch.exe"){
> > > > print "yes\n"; }else{ print "no\n"; }
> >
> > Here, "%systemdrive" is being treated as a Perl hash and probably
> > expands to a null string.
>
> Hashes aren't interpolated in strings - it's treated literally.
Good to know. I did say probably... :)
I just knew that it didn't do what he wanted and didn't bother to test
further.
> > > > # 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"; }
> >
> >
> > Here, you are explicitly opening a shell to get the environment
> > variable.
>
> Actually he's opening a shell and changing to the system drive
> which does nothing on return.
You're right. It doesn't work for me, but he claims it worked for
him. I just took his word for it and explained the difference between
the two. It would have worked with `echo %systemdrive%`.
--
Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs