BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
In a recent post I described a method I discovered for packing hashes and arrays. As part of the description, I typed a few examples into my REPL and pasted the output in the post; 10 lines of sample code being worth a 1000 words of verbiage.
But I just realised that I made a typo. Instead of using a template of n/(n/a*)*, I accidentally omitted the final *. But the mystery is, it still worked:
$packed = pack 'n/(n/a*)', 1..10;; @array = unpack 'n/(n/a*)', $packed;; print @array;; 1 2 3 4 5 6 7 8 9 10
The question is why? Why did pack see fit to pack all 10 values rather than just the first?
Is there a logical explanation, or are the last 3 digits of the id of the above linked node somehow responsible :)
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Mystery! Logical explanation or just Satan's work?
by SuicideJunkie (Vicar) on Aug 16, 2012 at 15:23 UTC | |
by BrowserUk (Patriarch) on Aug 16, 2012 at 16:01 UTC | |
by Anonymous Monk on Aug 16, 2012 at 16:46 UTC | |
by BrowserUk (Patriarch) on Aug 16, 2012 at 16:57 UTC |
Back to
Seekers of Perl Wisdom