Thanks for the help!
Couple of responses/questions:
1. I actually do use strict & warnings at the top of all of my scripts.
2. I actually had a typo in my copying over my routines. I didn't use 'for my $_ (@_)', rather I used 'for (@_)' and then used '$_' to reference the current iterated array element which I thought was always ok. At least it doesn't give me errors in 5.10.0
. 3. I like your way of not using eval.
4. However, I wanted to be able to pass something more general than just 'data'. For example. I might want to access several layers down as in: $self->{data}->{level2}->{level3}' etc. More generally, I would like to pass an arbitrary 'path' to some sequence of hashes and arrays to get/set to the desired accessor element. (btw I am using this to access elements of a JSON-decoded string which typically can be multiple levels deep)

In reply to Re^2: Creating flexible method accessor by puterboy
in thread Creating flexible method accessor by puterboy

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.