Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Reference madness

by Athanasius (Archbishop)
on Jul 31, 2017 at 13:39 UTC ( [id://1196360]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Reference madness
in thread Reference madness

Hello sdani,

I would say it's a quite unexpected behaviour..., because when I dump \@say, it prints out the expected results...

That’s because Data::Dumper (like Data::Dump) applies a dereferencing operation to its argument if that argument is a reference. This is usually what you want; but to avoid it, just print the variable instead:

23:27 >perl -MData::Dumper -wE "my @a = qw( a e i o u ); print Dumper( +\@a); print \@a;" $VAR1 = [ 'a', 'e', 'i', 'o', 'u' ]; ARRAY(0x4d2ec8) 23:27 >

Note the square brackets in the output from Data::Dumper: they denote an anonymous array reference. See perlreftut.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1196360]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-23 07:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found