Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: packing/unpacking/split/join confusion

by pfaut (Priest)
on Jan 01, 2003 at 14:34 UTC ( #223575=note: print w/ replies, xml ) Need Help??


in reply to packing/unpacking/split/join confusion

Why did you change your template? You specified "C*" with the unpack example and "C" with the pack example. "C*" matches as many characters as are in the string. "C" only matches one character.

$str = pack('C*',48,49,50,51,52); print "$str\n"; @chars = unpack('C*',$str); print join(', ',@chars),"\n";

... results in:

012345 48, 49, 50, 51, 52
--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';


Comment on Re: packing/unpacking/split/join confusion
Select or Download Code
Re: Re: packing/unpacking/split/join confusion
by sulfericacid (Deacon) on Jan 01, 2003 at 14:38 UTC
    Sorry, that was a typo. I am using C* in both cases.

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2014-09-30 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (370 votes), past polls