Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Get number ranges from files internally?

by talexb (Chancellor)
on Dec 31, 2001 at 21:44 UTC ( [id://135399]=note: print w/replies, xml ) Need Help??


in reply to Get number ranges from files internally?

I haven't tried running your code, but a couple of stylistic matters strike me right off the bat.

Don't read the entire file into an array -- that's slow, and it isn't necessary. Do something like

while (<>) { next if ( $_ !~ /\d/ ); # Skip records w/o numeric fields # Match, print if within range here.. }
instead. Much simpler.

Also, don't try to do everything in one line -- even :) if Perl will let you do that. If I were doing this project, I would probably split the incoming data line into an array (splitting on spaces) and then deal with the individual elements. If the date matches a particular value, then I would look at the time, splitting it on the ':', comparing to the time range that you want.

--t. alex

"Excellent. Release the hounds." -- Monty Burns.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-24 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found