Try $name =~ s/\s+$//
In reply to Re: Converting decimal value to hex by roboticus in thread Converting decimal value to hex by coldmiser