my @a = hexarray("EF F0 00 0F 01 02");
my $s = tohexs(@a);
print("$s\n");
sub tohexs
{
my $s = "";
foreach(@_){
$s .= sprintf("%02X ",$_);
}
chop($s);
return $s;
}
sub hexarray
{
my @s_ = split(/ /, $_[0]);
my @a = ();
foreach(@s_){
push(@a, hex($_));
}
return @a;
}
tohexs 는 tohexstring 의 줄임.
Sunday, December 30, 2012
hexadecimal 의 array 를 string 으로 얻어내는 Perl 함수
Labels:
Perl
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment