# Convert the decimal to hexadecimal and pad the result with a lea +ding # zero if needed. my $hex = sprintf("%x", $dec); $hex = length( $hex ) == 1 ? "0".$hex : $hex; #### my $hex = sprintf '%02x', $dec; #### sub basicSNTPSetup { ... sub keyDifference { .. }; }; #### sub basicSNTPSetup { ... }; sub keyDifference { .. }; #### my $verify_port = sub { my $port = shift; if ( defined $port && $port =~ /^[0-9]+$/ ) { if ( $port >= MIN_UDP_PORT || $port <= MAX_UDP_PORT ) { return FALSE; } } return TRUE; }; #### sub verify_port { ... }; #### if ( $port >= MIN_UDP_PORT || $port <= MAX_UDP_PORT ) { #### either: if ( ($port >= MIN_UDP_PORT) && ($port <= MAX_UDP_PORT) ) { or: if ( $port >= MIN_UDP_PORT and $port <= MAX_UDP_PORT ) {