...and slightly shorter|more extensible (if perhaps less efficient) way:
my $hex_addr=join '.',map {sprintf "%02x",$_} split /\./,$address;Or even:
(my $hex_addr=$address)=~s/(\d+)/sprintf("%02x",$1)/gx;...although of course the results could be a bit funny if it's not an IP address.
In reply to Re: Re: Re: Re: decimal -> hex
by Anonymous Monk
in thread decimal -> hex
by FireBird34
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |