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.
|
---|