Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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?


In reply to Win7, ASSOCiation , and @ARGV by ww

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-03-30 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found