Thank you one and all for your concise responses. I am sorry if I was a bit unclear and less than speedy in responding to the posts. I should have made my intentions clear; I don't have much experience with asking questions in a public forum like this one.

Essentially, I am creating a simple class, consisting of a constructor and an a method. The argument to the constructors sets the value of the datum, while the sub grants access to the datum.

I wanted to get around using explicit accessor and mutator methods and simply have a subroutine which, with a little syntactic sugar, could be used as a variable. I know, it sounds insane. Ne'ertheless, I shan't delve into my madness here.

My thinking, as unclear as it may seem, led me to believe a glob value could serve this dual purpose if one derefernced it properly:

package datum; our $value = undef; sub new { my $class = shift; local $value = shift; return bless { datum => $value, glob => *value }, $class } sub value { my $self = shift; return $self{glob} } 1

This "wants" to have the effect of returning an alias for the datum when used in a manner similar to the following:

use datum; my $d = datum->new(42); *d = $d->value(); # What I want to be able to here is something like: # $d = ...; $d->{foo} = ...; push @d, ...

Perhaps, this makes things a little more clear. Thank you in advance.

NOT P IMPLIES P IMPLIES Q

In reply to Re: Returning and using a glob from a sub. by mephtu
in thread Returning and using a glob from a sub. by mephtu

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.