in reply to Re^2: unpacking wmic command's unicode output
in thread unpacking wmic command's unicode output
Hrmmm . . . I copied only the relevant code from my script, above:
C:\chas_sandbox\columns-by-name> copy con ARGVtest.pl #!/usr/bin/perl -WCD use strict; use warnings; use Data::Dumper; $\ = $/; my $debug = 1; #array of fields to display my @processFields = ('Caption','ParentProcessId','ProcessId','CommandL +ine'); #ARGV processing my $searchfor = $ARGV[0] ? join(' ',@ARGV) : die("I need a process to +look for." ); ^Z 1 file(s) copied. C:\chas_sandbox\columns-by-name> notepad ARGVtest.pl
and changed it a little (in notepad, above) and tested it:
C:\chas_sandbox\columns-by-name> type ARGVtest.pl #!/usr/bin/perl -WCD use strict; use warnings; use Data::Dumper; $\ = $/; my $debug = 1; #array of fields to display my @processFields = ('Caption','ParentProcessId','ProcessId','CommandL +ine'); #ARGV processing my $searchfor = $#ARGV ? join(' ',@ARGV) : die("I need a process to lo +ok for."); # ^^^^^^ change here C:\chas_sandbox\columns-by-name> ARGVtest.pl I need a process to look for. at C:\chas_sandbox\columns-by-name\ARGVt +est.pl lin e 14. C:\chas_sandbox\columns-by-name> ARGVtest.pl chas I need a process to look for. at C:\chas_sandbox\columns-by-name\ARGVt +est.pl lin e 14.
and added some debug (in notepad again) and tested again:
C:\chas_sandbox\columns-by-name> type ARGVtest.pl #!/usr/bin/perl -WCD use strict; use warnings; use Data::Dumper; $\ = $/; my $debug = 1; #array of fields to display my @processFields = ('Caption','ParentProcessId','ProcessId','CommandL +ine'); #ARGV processing print Dumper(\@ARGV); print $#ARGV; my $searchfor = $#ARGV ? join(' ',@ARGV) : die("I need a process to lo +ok for."); C:\chas_sandbox\columns-by-name> ARGVtest.pl $VAR1 = [ '' ]; 0 I need a process to look for. at C:\chas_sandbox\columns-by-name\ARGVt +est.pl lin e 16. C:\chas_sandbox\columns-by-name> ARGVtest.pl chas $VAR1 = [ ' chas' ]; 0 I need a process to look for. at C:\chas_sandbox\columns-by-name\ARGVt +est.pl lin e 16.
. . . and it sure looks like $#ARGV is 0 either way. I totally trust your experience, so I conclude that either my test is wrong or my conclusions are. Does the she-bang line arguments mess this up or something?
#my sig used to say 'I humbly seek wisdom. '. Now it says:
use strict;
use warnings;
I humbly seek wisdom.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: unpacking wmic command's unicode output
by ikegami (Patriarch) on Nov 12, 2008 at 19:10 UTC | |
by goibhniu (Hermit) on Nov 12, 2008 at 19:21 UTC | |
by ikegami (Patriarch) on Nov 12, 2008 at 19:48 UTC | |
by goibhniu (Hermit) on Nov 12, 2008 at 20:41 UTC |
In Section
Seekers of Perl Wisdom