Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

What Am I missing?

If you ask me, it depends on what you're trying to learn.

Consider

$ perl -MData::Dump -e " my@f=1..3;my@g=4..6;push@f,\@g;push@g,@f;dd\ +@f,\@g; " do { my $a = [1, 2, 3, [4, 5, 6, 1, 2, 3, 'fix']]; $a->[3][6] = $a->[3]; ($a, $a->[3]); }

Do you notice 'fix'? Do you notice how the self-referential-ness is established in a second step?

Employ Basic debugging checklist and compare that to your Dumper output

@data1 = ( 'one', 'won', [ 'two', 'too', 'to', \@data1 ] ); @data2 = @{$data1[2]};

How is it different from what you originally had? Different from my dd output?

The order of operations isn't the same, @data2 is set to the values of some anonymous array, as opposed to a reference to @data2 being pushed onto @data1 -- the two references will never be the same

Could there be an error in the book?

I wouldn't know, but I don't quite see the lesson its trying to teach -- DD isn't the greatest serialization tool, and string-eval isn't the greatest way to Undumper / Data::Undump

or perl?

Well no, but you could argue it's a bug in Data::Dumper-s prefix/varname feature


In reply to Re: marshalling data by Anonymous Monk
in thread marshalling data by BillKSmith

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-03-19 06:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found