0x00000248, /* rv2hv */
0x00028404, /* helem */
0x00048801, /* hslice */
- 0x00022800, /* unpack */
+ 0x00122800, /* unpack */
0x0004280d, /* pack */
0x00222808, /* split */
0x0004280d, /* join */
# Explosives and implosives.
-unpack unpack ck_fun @ S S
+unpack unpack ck_fun @ S S?
pack pack ck_fun mst@ S L
split split ck_split t@ S S S
join join or string ck_join mst@ S L
=item unpack TEMPLATE,EXPR
+=item unpack TEMPLATE
+
C<unpack> does the reverse of C<pack>: it takes a string
and expands it out into a list of values.
(In scalar context, it returns merely the first value produced.)
+If EXPR is omitted, unpacks the C<$_> string.
+
The string is broken into chunks described by the TEMPLATE. Each chunk
is converted separately to a value. Typically, either the string is a result
of C<pack>, or the bytes of the string represent a C structure of some
PP(pp_unpack)
{
dSP;
- dPOPPOPssrl;
+ SV *right = (MAXARG > 1) ? POPs : GvSV(PL_defgv);
+ SV *left = POPs;
I32 gimme = GIMME_V;
STRLEN llen;
STRLEN rlen;
require './test.pl';
}
-plan tests => 5826;
+plan tests => 5827;
use strict;
use warnings;
ok(pack('u2', 'AA'), "[perl #8026]"); # used to hang and eat RAM in perl 5.7.2
+$_ = 'A';
+ok(unpack('c') == 65); # defaulting to $_