Advertisement
paperline27

Hex to String.pl

Jan 21st, 2024
1,497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.55 KB | Source Code | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Term::ANSIColor;
  5.  
  6. sub hex_to_string {
  7.     my $hex_input = shift;
  8.     my $string_representation = pack("H*", $hex_input);
  9.     return $string_representation;
  10. }
  11.  
  12. print color('bold blue');
  13. print "Masukkan representasi heksadesimal: ";
  14. print color('reset');
  15. my $user_hex_input = <STDIN>;
  16. chomp($user_hex_input);
  17.  
  18. my $string_result = hex_to_string($user_hex_input);
  19.  
  20. print color('bold green');
  21. print "String dari representasi heksadesimal '$user_hex_input': $string_result\n";
  22. print color('reset');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement