#!/usr/bin/perl use strict; use warnings; my $foo='look! no eval: 3735928559'; $foo=~s/(\d+)/${[sprintf '0x%08X',$1]}[0]/; print $foo;