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

Re: An odd flat file database question

by coolmichael (Deacon)
on Feb 08, 2001 at 08:27 UTC ( [id://57132]=note: print w/replies, xml ) Need Help??


in reply to An odd flat file database question

if you assume that $first and $last are the first and last catalog numbers the person wants, you could do this:
open FILE, "somefile.txt" || die "Blah: $!\n"; while(<FILE>){ m/^(\d+)\|/; print if(($first <= $1) and ($1 <= $last)); }
I'm not sure the regex is syntatically right. It's supposed to match all digits from the start of the line to the first pipe. it isn't tested, but I think it will work.

Michael.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2024-09-20 13:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (26 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.