You can do this by assigning a reference to the glob. Here is a sample to get you started.
#! /usr/bin/perl use strict; use vars qw($alpha_state); my %hash = (alpha => {state => "hello\n"}); *alpha_state = \$hash{alpha}{state}; # See that the variable got the value. print $alpha_state; # Show that they are really tied together. $alpha_state = "goodbye\n"; print $hash{alpha}{state};
If you need to set up a number of aliases, you can do no strict 'refs'; in a block and then set them up in there.

Of course you should use these techniques as sparingly as possible. Symbolic references really are a quick way to dig yourself a deep pit.


In reply to Re: Mandatory Symbolic References? by tilly
in thread Mandatory Symbolic References? by bfreemer

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.