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

Re^3: Parsing a text file in Perl.

by Athanasius (Archbishop)
on May 26, 2014 at 11:11 UTC ( [id://1087420]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Parsing a text file in Perl.
in thread Parsing a text file in Perl.

If you want to match [==========] in a regex, you need to escape the square brackets — otherwise they form a character class.

However, this approach cannot work: you are reading the data file line-by-line, which to Perl means from one newline (\n) to the next, but a typical line of input looks like this:

< 0x00070: 2d 64 6f 77 6e 0d 0a 5b 3d 3d 3d 3d 3d 3d 3d 3d -down.. +[========

As can be seen, there are no lines which match [==========]. Likewise, the special regex character ^ matches at the beginning of a line, and neither [==========] nor tests appears at the beginning of a line.

You will need a different strategy, along the lines outlined by hippo below.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found