Ben writes..

>I still have a mystery however.  When I run the following command:
>
>perl -e "print '*:'.Win32::GetLongPathName( my
>$p=Win32::GetFullPathName(qq(/PROGRA~1))).';;;';"
>
>Then I get the expected output, which is something like:
>*:C:\Program Files;;;
>
>However, If I remove the "my $p=" from the above command, that is:
>perl -e "print '*:'.Win32::GetLongPathName(
>Win32::GetFullPathName(qq(/PROGRA~1))).';;;';"
>
>Then I get a syntax error.  The message is: "usage:
>Win32::GetLongPathName($pathname) at -e line 1.".  I don't see why I am
>getting the error, and I'd rather not define the dummy 
>variable $p.  Can
>anyone explain why I am getting this error?

GetFullPathName can be called in list and scalar contexts. The dummy
scalar assignment forces a scalar context, without that it assumes list
context. This works

  perl -e "print '*:'.Win32::GetLongPathName(
    scalar Win32::GetFullPathName(qq(/PROGRA~1))).';;;';"

(paste back together)

-- 
  Jason King
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to