Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: I need Hex conversion, not!

by choroba (Chancellor)
on Jan 07, 2013 at 13:31 UTC ( #1012031=note: print w/replies, xml ) Need Help??

in reply to I need Hex conversion, not!

You can profit from the core Scalar::Util's dualvar:
#!/usr/bin/perl use warnings; use strict; { package DecHex; use Scalar::Util qw(dualvar); sub create { my $num = shift; my $string = sprintf '%X', $num; my $self = dualvar($num, $string); } } my $x = DecHex::create 0xFE; print "$x, ", 0+$x, "\n";
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: I need Hex conversion, not!
by Anonymous Monk on Jan 07, 2013 at 17:34 UTC

    That is really nice, I think this is what I wanted, thank you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012031]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2016-10-26 22:18 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (350 votes). Check out past polls.