perlquestion
BrowserUk
<blockquote><i></i></blockquote>
<p>In a recent [987666|post] I described a method I discovered for [pack]ing 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.
<p>But I just realised that I made a typo. Instead of using a template of <c>n/(n/a*)*</c>, I accidentally omitted the final <c>*</c>. But the mystery is, it still worked:<code>
$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
</code>
<p>The question is why? Why did [pack] see fit to [pack] all 10 values rather than just the first?
<p>Is there a logical explanation, or are the last 3 digits of the id of the above linked node somehow responsible :)
<div class="pmsig"><div class="pmsig-171588">
<hr />
<font size=1 >
<div>With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'</div>
<div>Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.</div>
<div>"Science is about questioning the status quo. Questioning authority". </div>
<div>In the absence of evidence, opinion is indistinguishable from prejudice.
<p align=right>[http://www.theregister.co.uk/2011/11/29/sas_versus_world_programming/|The start of some sanity?]</p></div>
</font>
</div></div>