I have three integers:
($r, $g, $b) = (255, 128, 0);
I would like to print a string like:
"#FF8000"
using those variables.
How do I do this?
I have three integers:
($r, $g, $b) = (255, 128, 0);
I would like to print a string like:
"#FF8000"
using those variables.
How do I do this?
You could use pack
and unpack
, to get the hexadecimal string.
my $rgb = '#' . uc unpack 'H6', pack 'C3', $r, $g, $b;