my $text = 'WHY HELLO THERE!'; # split into array of individual characters my @characters = split(//,$text); # transform each one individually into uppercase hex foreach my $char (@characters) { $char = uc(unpack "H*", $char); } # print in quotes to demonstrate separation between array elements print "@characters";