Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: read ARGV ==> read on unopened filehandle

by pg (Canon)
on Sep 18, 2005 at 01:49 UTC ( [id://492960]=note: print w/replies, xml ) Need Help??


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.";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found