in reply to Re: search binary file
in thread search binary file

data is like:
"my data^A77789^B^Bmore data"; i tried to match it using "/(data^A)(\d+)^B/", i would expect:
$1 = data^A
$2 = 77789
however, it didn't work. (note: ^A is one character)

Replies are listed 'Best First'.
Re^3: search binary file
by pc88mxer (Vicar) on Jul 11, 2008 at 21:20 UTC
    By ^A do you mean Control-A (i.e. chr(1)?

    If so, use this:

    if ($input =~ m/(data\x1)(\d+)\x2/) { print "1 = $1, length = ", length($1), "\n"; print "2 = $2\n"; }
      yes ^A means ctrl-A, thanks superdoc, your tip works