You have:
$sn = $entry3; $$sn = new DEVICE;
and then say:
> I think the error is bogus, and that it somehow doesn't > like the anon reference thingie.
That's not an anonymous reference. You've set $sn equal to the value of $entry3 and are then trying to use that value as a reference. That's not going to work, because it's not a reference.

Try this:

$entry->[3] = new DEVICE;
Assuming that $entry is an array reference. Isn't it, the first time you tried to use it?

In addition: you haven't shown us all of your code, but if you're just looping through data and creating a new DEVICE for each line of the data, then adding that to an array... are you by any chance using an incremented loop counter to hold your array index? :)

If so, you should try this instead:

push @$entry, new DEVICE;
which eliminates the need for the "synthetic" array size indicator. For more on this sort of thing, see Mark-Jason Dominus's Return of Program Repair Shop and Red Flags.

In reply to Re: Anon Struct Instance by btrott
in thread Anon Struct Instance by THuG

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.