Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Reading contents of file using regex

by bart (Canon)
on Jan 31, 2006 at 11:09 UTC ( [id://526710]=note: print w/replies, xml ) Need Help??


in reply to Reading contents of file using regex

You've got one obvious error, and that maybe due to copying from a HTML page:
$line=;
should be
$line=<IN>;

Furthermore, it might be a good idea to add the /g flag to your regex in the while condition. That way, it won't try to match again and again from the start, but instead it'll continue next time where it left off last time.

while ($line=~m/([123]?[.s]*[a-z\=.]+)/ig)
Oh, the /o is useless, you don't have a variable in your regex. So I dropped it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found