On Tue, 25 Jun 2002 16:19:05 +0000, molmon(_at_)hotmail(_dot_)com (Imran Khan)
wrote:
Q: Does pack have to take a deminal integer - or can i somehow pass a hex
value to it?
ie something like: my $tmp_char= pack("U", 263A);
pack('U') takes an integer. You can specify that integer in several
ways, just as in most other parts of Perl:
pack('U', 9786); # decimal -- default
pack('U', 0x263a); # hexadecimal, with leading 0x
pack('U', 023072); # octal, with leading 0
pack('U', 0b0010_0110_0011_1010); # binary, with leading 0b
pack('U', 6*7*233); # calculated
and so forth. Have a look at `perldoc perldata`, the section on "Scalar
value constructors", for more information on how to specify numeric
literals in Perl source code.
Cheers,
Philip