Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Term::ANSIColor;
- sub string_to_hex {
- my $input_string = shift;
- my $hex_representation = unpack("H*", $input_string);
- return "0x$hex_representation";
- }
- print color('bold blue');
- print "Masukkan string yang ingin diubah ke heksadesimal: ";
- print color('reset');
- my $user_input = <STDIN>;
- chomp($user_input);
- my $hex_result = string_to_hex($user_input);
- print color('bold green');
- print "Representasi Heksadesimal dari '$user_input': $hex_result\n";
- print color('reset');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement