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

Re: Regular Exp. Problem!

by matija (Priest)
on Apr 15, 2004 at 10:48 UTC ( #345350=note: print w/replies, xml ) Need Help??


in reply to Parsing Log Files

You need to escape (replace * with \*) all the stars that are used as separators. Otherwise, the regexp engine will take them to mean "the previous element can repeat 0 or more times".

Something like this might be closer:

/^(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)$/

As for the second part of the question: You are using essentialy the correct method, but instead of pushing $1 into an array, and then iterating over that array, you can just assign to the has right at the point where you do the push now.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2020-08-15 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (78 votes). Check out past polls.

    Notices?