[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] "rewinding" a file



At 14:46 96-06-20, Jonny Axelsson wrote:

>I'm a Perl novice, but this is not strictly true. Nothing wrong with the
>programming as far as I know, but the method of ensuring that the keys are
>unique is flawed.

You are correct (I did say the code was untested).  Assuming ASCII
keys, the following should be more robust (which just uses $; as a
separator):

        # you only need the following 3 lines if keys aren't unique
        $keyindex = 0;
        $keyindex++ while defined( $a{ "$1$;$keyindex" } );
        $key .= "$;$keyindex";
        # end of non-unique key handling

Of course many, many other tweaks are needed to make the posted code
work for a give situation!

Thanks for catching the glaring glitch....

--Hal
Hal Wine <hal@dtor.com>     voice: 510/482-0597