my $check = sprintf '%x', int rand( 0xffff ); # first 16 bits $check .= sprintf '%x', int rand( 0xffff ); # second 16 bits