Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Binary buffer - substr

by dave_the_m (Parson)
on Jan 13, 2013 at 22:53 UTC ( #1013139=note: print w/ replies, xml ) Need Help??


in reply to Binary buffer - substr

(my $out_packet = $packet_dump) =~ s/^.*?(?=\x16\x03\x01\x01)//s;
edit: added /s modifier as pointed out by 7stud

Dave.


Comment on Re: Binary buffer - substr
Download Code
Re^2: Binary buffer - substr
by highland7 (Novice) on Jan 13, 2013 at 23:08 UTC
    Thanks, it's working !!!
Re^2: Binary buffer - substr
by highland7 (Novice) on Jan 14, 2013 at 00:03 UTC
    One more question: How can i find index number for specific binary string ? I would like to find out from which byte that specific 4 bytes appear (/x16/x03/0x1/0x0) Thanks
      index($packet_dump, "\x16\x03\x01\x01")

      Dave.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-07-14 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (255 votes), past polls