Today around 10:45am, Steve Fink hammered out this masterpiece:

: Ted Ashton wrote:
: > 
: > >                                                               all
: > > dereferencing can be done with ->.
: > 
: > Is that "can be done with" or "must be done with"?
: > 
: > Either way, I like the idea.  To me it reads more smoothly, and as I seldom
: > dare to use the double-punctuation form ($$ and so on) and use instead the
: > ${$} form, it would be an equal number of characters and fewer curlies (which,
: > I think, is a win).
: 
: Can be done with. @{ foo() || bar() } seems preferable to, say,
: [scalar(foo() || bar())]->[0]->@. :-)

I've seen this possible syntax brought up before at another forum.

where:

@{$hashref->{key}}

would be:

$hashref->{key}->@

This looks counter intuitive, my brain says to dereference the reference at the
begining, just like you make the reference, in other words, keep it all the
same:

$hashref->{key}->@ # Deref
$hashref->{key}->$ # Deref
$hashref->{key}->% # Deref
$hashref->{key}->* # Deref
$hashref->{key}->& # Deref
$hashref->{key}->\ # Reference

This is just ugly.  If it's less line noise and/or punctuation, temp vars is the
key.  I know this has been said before:

$arrayref = $hashref->{key}

@{$arrayref};
#or
@$arrayref;

On the other hand, another hacker and I thought up and attempted to write a
pragma ( attempted because as far as I know, neither of us has touched it in a
long while ) that degreases line noise in terms of punctuations, sorta.  It's
more verbose anyhow, where:

@{ $hashref->{key} };

becomes:

ARRAY{ $hashref->{key} };

And the same holds true for SCALAR, HASH, CODE, GLOB and such.  It's an
alternative that hasn't been thought out much, but perhaps kinda neat.

-- 
print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'[EMAIL PROTECTED]',site=>
'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>

Reply via email to