You can't get rid of the sigils $%@ in Perl, because of conflicts with barewords which have many other meanings and the many bultin commands which depend on sigils.

But this last example of aliasing a list-form and hashref-form \%hsh = $hsh could be simplified, such that the deref -> isn't needed anymore.

use Keyword::Simple to define a new command like e.g. var or let and any

var %hsh = LIST;

is translated to

my $hsh = \ my %hsh; %hsh = LIST;

This is not too hard to implement, because you don't need to parse LIST in advance (which could be arbitrary Perl code)

Like this explicit dereferencing with -> would be "simplified" away.

Demo:

DB<27> sub LIST { foo => { x => 42 } } DB<28> $bar ='x' DB<29> my $hsh = \ my %hsh; %hsh = LIST; \\ cont: say $hsh{foo}{$bar} 42

Of course that way you'd loose the ability to have $ident and %ident in different namespaces, but that's often considered bad style anyway.

And passing of hash-refs, like with function-parameters wouldn't be that easy without additional \ref-operation

sub func { var (\%hsh,\@arr) = @_; }

because otherwise var couldn't tell if a $scalar is meant to be aliased to a %hash or an @array

sub func { var ($hsh,$arr) = @_; # ??? }

tho you might be able simplify the syntax in many cases with

sub func { var \(%hsh,@arr) = @_; }

HTH! :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re^3: Modules to reduce syntax? (joining namespaces) by LanX
in thread Modules to reduce syntax? by sectokia

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.