Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Unpack()ing a stream

by Stevie-O (Friar)
on May 24, 2004 at 18:03 UTC ( #356004=note: print w/ replies, xml ) Need Help??


in reply to Re: Unpack()ing a stream
in thread Unpack()ing a stream

It should work with any input unpack() itself normally works with. It's a simple (and inefficient) technique: It appends 'a*' to the end of the unpack string and pops off the last element returned. This will be the remainder of the string. A simple subtraction (length($fullstring) - length($remainder)) will reveal the point at which unpack() stopped unpacking the data the user actually asked for.

--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc


Comment on Re: Re: Unpack()ing a stream
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-11-25 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (160 votes), past polls