my $check = sprintf '%x', int rand( 0xffffffff ); ## Bad!! See [roger]'s post below. my $check = sprintf '%x', int( rand(0xffff) )<<16 | int( rand( 0xffff ) ); ## Probably OK.