in reply to Re^2: Converting decimal value to hex
in thread Converting decimal value to hex

Easier way:
$name =~ s/(\s+)$//;