Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Help with parsing a string

by GrandFather (Saint)
on Jul 22, 2008 at 21:38 UTC ( [id://699435]=note: print w/replies, xml ) Need Help??


in reply to Help with parsing a string

Well, you could:

use strict; use warnings; my $byte = qr/([0-9a-f]{2})/i; while (<DATA>) { my $line = join '', /\b$byte\b/g; next unless length $line; print "$line\n"; } __DATA__ 00 0A EF 85 BA 8F AA BC Wibble 00 0A EF 85 BA 8F AA BC

Prints:

000AEF85BA8FAABC 000AEF85BA8FAABC

Perl is environmentally friendly - it saves trees

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found