trying to convert hex to ascii and was able to convert. Any idea code can be written more efficiently. Please preview.
my $x = 30:30:3a:31:64:3a:69:2d:6f; #in hex my $x =~ tr/://d; my $y = hex_to_ascii("$x"); print "$y\n"; #in ascii
Above can be achieved using one liner? Tried using pack and unpack and closest i can think of was split, conversion and pack. Preview and guide how to correct. Thanks!
my $y = pack ('C*', split/\:/, $x);
In reply to Perl Hex ASCII pack unpack by waytoperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |