タグ

packに関するtrashsuiteのブックマーク (2)

  • perlpacktut - pack と unpack のチュートリアル

    pack and unpack are two functions for transforming data according to a user-defined template, between the guarded way Perl stores values and some well-defined representation as might be required in the environment of a Perl program. Unfortunately, they're also two of the most misunderstood and most often overlooked functions that Perl provides. This tutorial will demystify them for you. pack と unp

  • Perl の数値変換

    Last Updated: 2002/03/26 Perl で、16進文字列、10進整数、2進文字列、バイナリー文字列の相互変換を行うための、スクリプトメモです。 特に断っていない限り、Perl 5.001 以上で動作します。 目次 16進文字列からの変換 10進整数からの変換 2進文字列からの変換 バイナリー文字列からの変換 16進文字列→10進整数への変換 hex() 関数は、16進文字列を整数値に、手軽に変換できます。 $num10 = hex("4A"); # $num10 には 74 が入る $num10 = hex("FFFFFF"); # $num10 には 16777215 が入る 余談ですが、数値リテラル中では 0x に続けて 16 進数で記述することで、数値を表すことができます。 $num10 = 0x4A; # 74 $num10 = 0xFFFFFF; # 1677

  • 1