Encoding ASCII with Perl 

say ord('A');                       # 65

say sprintf('%02X', ord('A'));      # 41