in reply to unpack 'C/a*' and context weirdness


This does seem a little strange and the behaviour seems to have changed between perl 5.6.1 and 5.8.0. So maybe it was a bug that was fixed.

With perl 5.6.1, I get:

$ perl -le 'print scalar unpack "C/a*", pack "C/a*", "Test"' 4
With perl 5.8.0, I get:
$ perl -le 'print scalar unpack "C/a*", pack "C/a*", "Test"' Test

Update: The pack documentation for both versions state "The length-item is not returned explicitly from unpack.". So it looks like the 5.6.1 version is wrong.

--
John.

Replies are listed 'Best First'.
Re: Re: unpack 'C/a*' and context weirdness
by BrowserUk (Patriarch) on Feb 14, 2003 at 23:28 UTC

    Thanks for tracking that down. Thanks also to jsprat and robartes.

    Another reason to move up to 5.8 I guess. It's just the pain of re-installing everything from the 5.6.1 site/lib dir to the 5.8 dirs. Oh well, sooner I start, sooner its done.... tomorrow. I'll do it tomorrow:)


    Examine what is said, not who speaks.

    The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

      Use the wonder of the CPAN module to help you when upgrading, you can run it under 5.6.1 and use the 'autobundle' command to make a bundle file that describes all the modules you have installed. Then install 5.8, and use CPAN again to install the bundle, and it will download and install all the modules you had in 5.6.1.

        Unfortunately, the only "wonder" in the CPAN module for me, is the wonder that it continues to be used. It worked exactly once for me after install. It then screwed it own configuration, which is so complex, incestuous, unintuative and badly documented, that despite spending several sessions of several hours each on trying to unwind and understand it, I gave up. I am not easily defeated but that was just to much for me.

        I discovered that I can install the modules I need, including those with binary components (if available for my system) manually via my browser in less time than it takes the CPAN module to load, connect, spin and tell me it can't find what I am looking for. YMMV, but that is my experience.


        Examine what is said, not who speaks.

        The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.