in reply to Re: decimal -> hex
in thread decimal -> hex
my ($a,$b,$c,$d) = $address =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; my $hex_addr = sprintf "%02x.%02x.%02x.%02x", $a, $b, $c, $d;
Save yourself some typing and use an array :-)
my @bytes = $address =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; my $hex_addr = sprintf "%02x.%02x.%02x.%02x", @bytes;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: decimal -> hex
by bart (Canon) on Oct 12, 2002 at 10:12 UTC | |
by Anonymous Monk on Oct 13, 2002 at 07:27 UTC | |
by Anonymous Monk on Oct 13, 2002 at 07:34 UTC | |
|
Re: Re: Re: decimal -> hex
by FireBird34 (Pilgrim) on Oct 11, 2002 at 16:05 UTC |