http://qs1969.pair.com?node_id=1116898


in reply to Re: pack() v unpack() padding: bug or ???
in thread pack() v unpack() padding: bug or ???

unpack is deciding to remove trailing spaces, I guess in the assumption that they are artifacts from pack.

Same question: can anyone describe the use they made of that? Or even think of a use for it?

In the end it all comes down to my need to chop an arbitrary length string into n-byte chunks; and the requirement to have the last chunk padded if it is shorter than n.

It seems to me that this is a fairly common requirement -- think all the Digest::* modules that need to operate upon fixed-sized chunks of data -- and there isn't (AFAIK) a clean way to do that.

And here we have a couple of templates that almost do it; but at the margins, do something that whilst they can be reasoned (with squinty eye's and big dollop of belief suspension), to be "doing the opposite of pack"; do things that there are no good uses for; whilst leaving the common requirement unserviced.

That's just not very Perlish.


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". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
  • Comment on Re^2: pack() v unpack() padding: bug or ???