Shawn H Corey wrote:
> On 11-03-29 07:50 PM, Noah Garrett Wallach wrote:
>>
>> s/(\d+)\.(\d+)\.(\d+)\.(\d+)/$1:$2:$3:$4::0/
>>
>> so is there a slick, easily readable way to get the value $1, $2, $3, $4
>> to be rewriten as %x instead of a %d?
>
> s/(\d+)\.(\d+)\.(\d+)\.(\d+)/sprintf('%x:%x:%x:%x::0',$1,$2,$3,$4)/e;
Might be better as:
sprintf '%x:%x:%x:%x::0', /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
So you don't have to use eval.
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
Thread Previous
|
Thread Next