in reply to I need Hex conversion, not!
This works, but it will give you a slight performance hit. Unless you're doing serious number crunching it'll probably be acceptable...
use strict; use warnings; sub hexnum { package HexNum; use base 'Math::BigInt'; use overload q[""] => 'as_hex'; __PACKAGE__->new(@_); } my $var = hexnum 0x2F; $var += 3; $var += hexnum 0x02; print "$var\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: I need Hex conversion, not!
by Anonymous Monk on Jan 07, 2013 at 17:17 UTC | |
by tobyink (Canon) on Jan 08, 2013 at 09:33 UTC |