in reply to Re: A little C code converted to Perl *HELP*
in thread A little C code converted to Perl *HELP*

This is an excellent solution. However you probably want to do the assignment in two steps -
my $check = sprintf '%x', int rand( 0xffff ); # first 16 bits $check .= sprintf '%x', int rand( 0xffff ); # second 16 bits
Otherwise the last 16 bits of $check is always 0xffff, at least on my version of Perl.

Replies are listed 'Best First'.
Re: Re: Re: A little C code converted to Perl *HELP*
by BrowserUk (Patriarch) on Nov 03, 2003 at 05:24 UTC

    Good point++

    I should have checked that! I've amended the post.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!