Sigils are hard to teach . . . very useful once you get someone to understand them, but that first step can be hard.

So why not get rid of them? That's what I set out to do, but instead wound up with STUPID (Sigils Turned Unified . . . uh . . . PID). STUPID will turn all four of Perl's sigils to the ampersand: &. You must assign to these variable in a more Python/Ruby - ish idiom, much like constructing anonymous arrays and hashes. In fact you are. They no londer interpolate in double quoted strings, and the implementation doesn't always work, AND you have to explicity dereference arrays/hashes. I couldn't think where this should really belong, but I figured this was the closest place in the Monestary. Enjoy, and don't take seriously.

sub AUTOLOAD : lvalue { (!ref ${$AUTOLOAD}) ? ${$AUTOLOAD} : (!wantarray) ? ${$AUTOLOAD} : (ref ${$AUTOLOAD} eq 'ARRAY' +) ? @{${$AUTOLOAD}} + : %{${$AUTOLOAD}}; }
Cheers,
Erik

ps. Yes I am aware that it uses sim-refs . . . it's just a joke man :-)

pps - Here's how to use this little gizmo . . .

#include AUTOLOAD from above . . . &foo = ['a', 'b', 'c']; print &foo->[0];

UPDATE:

Alright! I don't know if anyone will ever read this, but just in case, it should be noted that Perl 5.8 fixes the problem with lvalue AUTOLOAD which required that you use the & funny character. Now this little snippet truly eliminates sigils entirely. I think. I actually haven't been able to test it, 'cause my computer is broken. /msg me if it works


In reply to One Sigil to Hack them All . . . by erikharrison

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.