Help for this page

Select Code to Download


  1. or download this
    my @bytes = $address =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
    my $hex_addr = sprintf "%02x.%02x.%02x.%02x", @bytes;
    
  2. or download this
    my $hex_addr = sprintf "%02x.%02x.%02x.%02x", $address =~ /(\d+)\.(\d+
    +)\.(\d+)\.(\d+)/;
    
  3. or download this
    my $hex_addr = sprintf "%02x.%02x.%02x.%02x", split /\./, $address;
    
  4. or download this
    use Socket;
    my $address = '127.1';
    my $hex_addr = sprintf "%02x.%02x.%02x.%02x", unpack 'C*', inet_aton($
    +address);