in reply to Re: read ARGV ==> read on unopened filehandle
in thread read ARGV ==> read on unopened filehandle

"To see what I mean, put your read() in a while loop, save it in script.pl, dump some data in two test files, and try calling your script as script.pl test1.txt test2.txt. You will find that your script never gets to the data in test2.txt."

I knew that you had clearly stated read(), but I still want to specifically mention that this is not an issue with <>, so that nobody got confused.

Create two data files, test1.txt:

test1 line1 test1 line2 test1 line3

And test2.txt:

test2 line1 test2 line2 test2 line3

Use the same code that I mentioned in my first post in this thread, and run perl -w blah.pl test1.txt test2.txt, and you get:

test1 line1 test1 line2 test1 line3 test2 line1 test2 line2 test2 line3

Replies are listed 'Best First'.
Re^3: read ARGV ==> read on unopened filehandle
by sauoq (Abbot) on Sep 18, 2005 at 01:59 UTC

    Uh, yes pg... that's sort of the point. You are, I think, restating the obvious. Essentially, you are saying that ARGV works correctly when used correctly. That's true, of course. It just isn't exactly what this discussion was about.

    The original node was proposing a solution to using ARGV with read() and the point is that there is no good solution to that. That's not how ARGV should be used. Instead, it should be used with <> only.

    -sauoq
    "My two cents aren't worth a dime.";