Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Concept map of data types

by programmer.perl (Beadle)
on Jul 22, 2012 at 08:34 UTC ( #983048=note: print w/ replies, xml ) Need Help??


in reply to Re: Concept map of data types
in thread Concept map of data types

Thanks,

Here, in your examples I found my mistake, instead of @ I wrote %, I corrected this. Last updated map is above, you can see.

Yesterday I look for a Data::Dumper in a CPAN but I didn't undesrtand how to use it. I am new in using cpan and modules. I red SYNOPSIS but didn't understand how to use them (code). Do you have any link that help me in this case? In cpan modules till now I could use just Date::Format.


Comment on Re^2: Concept map of data types
Re^3: Concept map of data types
by Athanasius (Abbot) on Jul 22, 2012 at 08:52 UTC
    Yesterday I look for a Data::Dumper in a CPAN but I didn't undesrtand how to use it.

    Data::Dumper is a core module, so you can view its documentation in perldoc. See especially the EXAMPLES section.

    HTH,

    Athanasius <°(((><contra mundum

Re^3: Concept map of data types
by aitap (Deacon) on Jul 22, 2012 at 09:10 UTC

    Data::Dumper can be used to do a lot of interesting things, but basically, you just need to use Data::Dumper and then print Dumper (anything).

    It can be useful to pass a reference to the object you want to see, not just this object. For example, it's useful in case of AoH (array of hashes):

    use Data::Dumper; my @hashes = ( { one => 1, two => 2, three => 3 }, { one => 11, two => 22, three => 33 }, ); print Dumper @hashes; print "-"x5,"\n"; print Dumper \@hashes; __END__ $VAR1 = { 'three' => 3, 'one' => 1, 'two' => 2 }; $VAR2 = { 'three' => 33, 'one' => 11, 'two' => 22 }; ----- $VAR1 = [ { 'three' => 3, 'one' => 1, 'two' => 2 }, { 'three' => 33, 'one' => 11, 'two' => 22 } ];
    ...but it does not improve anything in case of reference to array of references to arrays:
    my $reference = [ [ 7, 8, 9 ], [ 10, 11, 12 ], ]; print Dumper $reference; print Dumper \$reference; $VAR1 = [ [ 7, 8, 9 ], [ 10, 11, 12 ] ]; $VAR1 = \[ [ 7, 8, 9 ], [ 10, 11, 12 ] ];

    Sorry if my advice was wrong.
Re^3: Concept map of data types
by 2teez (Priest) on Jul 22, 2012 at 09:28 UTC
    Hi,

    You can use Data::Dumper like so:

    use Data::Dumper; my @abc = #abc is an array of references to arrays ( [qw (q w e r)], [qw (1 x 3 r)], [qw (qwe rt 434 )], ); print Dumper ( \@abc ); ## pass array @abc as an array reference my $abc = #abc is an array reference that contains references to ar +rays [ [qw (q w e r)], [qw (1 x 3 r)], [qw (qwe rt 434 )], ]; print Dumper ($abc); ## pass the array reference

    Both print the following:

    $VAR1 = [ [ 'q', 'w', 'e', 'r' ], [ '1', 'x', '3', 'r' ], [ 'qwe', 'rt', '434' ] ];
    Showing 'stringified perl data structures'. It shows you how your data is structured.
    Hope this helps

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2015-07-06 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (80 votes), past polls