http://www.perlmonks.org?node_id=959491

ww has asked for the wisdom of the Perl Monks concerning the following question:

SOLVED! There's much useful info in this thread, which led to the conclusion that reinstalling Perl was the first best option. Using AS on Win7 (and probably elsewhere), right clicking the Perl executable in REMOVE PROGRAMS brings up 3 options, of which "Repair" uses the originally downloaded .msi.

... and, lo and behold, the quirks are gone!

I came across an interesting quirk recently (caveat: but it seems very likely that it's an OS issue, so don't invest a lot of attention unless you've an interest in something that appears to suggest a Perl issue -- and, that, and only at first glance).

Relying on Windows7's file ASSOCiation function to use Perl to execute the code below produces nothing but newlines when three arguments are provided on the command line, thus:

C:\>YA_ARGV_test.pl foo bar baz C:\>

That would appear to be a line for $ARGV[0], [1] and [2] and a fourth, blank as expected, before the prompt repeats.

But explicitly invoking Perl produces the expected result:

C:\>perl YA_ARGV_test.pl foo bar baz foo bar baz foo bar baz C:\>

The code in question is simplicity itself (well, almost -- except for the belt and suspenders mode):

#!/usr/bin/perl use 5.014; use feature qw(say); my @arr = @ARGV; say $ARGV[0]; say $ARGV[1]; say $ARGV[2]; for $_ (@arr) { say $_; }

Running a minimal version of the same code as a one-liner also produces the expected output:

C:\>perl -e "use 5.014; for $_ (@ARGV) { say $_; }" foo bar baz foo bar baz C:\>

...as does running the program in the debugger, invoked perl -d fn.pl arg arg arg./p>

That fact which refocuses my curiosity about whether the flaw lies with Win7's ASSOCiation or somewhere else.

The Perl and machine? AS v. 5.14.2; Win7, Home_Pro (correcting misstatement: Professional), 32 bit x86, SP1, and....

C:>assoc .pl .pl=Perl C:\>ftype perl perl="C:\Perl\bin\perl.exe" "%1" %*

I mention those two checks -- with produce the 'book answers' -- because in a 2010 thread on a similar problem, ikegami noted the likelihood that OP's problems stemmed from a broken ASSOCiation. That doesn't appear to be the case, here.

Ideas? Ideas for testing hypotheses? Proven answers?