読者です 読者をやめる 読者になる 読者になる

変換系の確認

perl
use strict;
use warnings;
use Devel::Peek qw/Dump/;


# 74                                                                            
print Dump hex("4A");
print Dump 0x4A;


# "AB\0"                                                                        
print Dump pack("H*", "4142");
print Dump "\x41\x42";


# 65                                                                            
print Dump unpack("C*", "A");


# "A\0"                                                                         
print Dump pack("C*", 65);


# "48656c6c6f2c20576f726c6421\0"                                                
print Dump unpack("H*", "Hello, World!");


# "Hello, World!\0"                                                             
print Dump pack("H*", "48656c6c6f2c20576f726c6421");