Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: unpacking wmic command's unicode output

by goibhniu (Hermit)
on Nov 12, 2008 at 19:21 UTC ( #723269=note: print w/ replies, xml ) Need Help??


in reply to Re^4: unpacking wmic command's unicode output
in thread unpacking wmic command's unicode output

What about the print $#ARGV; statement that printed 0 where you seem to have predicted it should print -1?

I take your point about the difference between $#ARGV (highest index) and @ARGV in scalar context (number of elements) and agree I should have used the number of elements. That's a mental block for me and has caused me problems in the past.

I also take your point about complexity. I think I was looking for something parallel in style to open() || die(); for consistency.


#my sig used to say 'I humbly seek wisdom. '. Now it says:
use strict;
use warnings;
I humbly seek wisdom.


Comment on Re^5: unpacking wmic command's unicode output
Download Code
Re^6: unpacking wmic command's unicode output
by ikegami (Pope) on Nov 12, 2008 at 19:48 UTC

    I ran your exact script and got the right result.

    >ARGVtest.pl $VAR1 = []; -1

    I think your system's handling of .pl files is broken.

    1. First, get the file type from the default key of HKEY_CLASSES_ROOT\.pl. For me, it's "Perl".
    2. Then, set the default key of HKEY_CLASSES_ROOT\Perl\shell\Open\command to "c:\perl\bin\perl.exe" "%1" %* (where "Perl" is the file type from the first step).

    As a .reg:

    Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.pl] @="Perl" [HKEY_CLASSES_ROOT\Perl] @="Perl File" [HKEY_CLASSES_ROOT\Perl\shell] [HKEY_CLASSES_ROOT\Perl\shell\Open] [HKEY_CLASSES_ROOT\Perl\shell\Open\command] @="\"c:\\perl\\bin\\perl.exe\" \"%1\" %*"

      Curiouser and curiouser . . .

      My HKCR\PerlScript\Shell\Open\Command is:
      C:\strawberry-perl\perl\bin\perl.exe "%1" "%*"

      I don't have HKEY_CLASSES_ROOT\Perl

      update: I took off the quotes around the %* and got your predicted results leaving me only with the $#ARGV vs. scalar(@ARGV) bug. THANKS and ++!


      #my sig used to say 'I humbly seek wisdom. '. Now it says:
      use strict;
      use warnings;
      I humbly seek wisdom.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://723269]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2014-10-24 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (134 votes), past polls