R – see HASH(0xABCDEF) in the Perl output

perlreferencestringification

I am running perl, v5.6.1 built for sun4-solaris-64int

I am calling print on an array:

print "@vals\n";

and the output looks like:

HASH(0x229a4) uid cn attuid

or another example:

@foo = {};
push(@foo, "c");

print "@foo I am done now\n";

with output of:

HASH(0x2ece0) c I am done now

Where is HASH(0x2ece0) coming from?

Best Solution

Your braces in @foo = {} are creating it. The braces create an unnamed hash reference.

If you want to set @foo to an empty list, use @foo = ()

Related Question