On Monday 15 July 2002 06:57 am, Sean O'Rourke wrote:
> On Sun, 14 Jul 2002, Brent Dax wrote:
> > Deborah Ariel Pickett:
> > # My perl5 sensibilities tell me that that's likely to cause a
> > # problem when I want to do something like this:
> > #
> > # $hashref = { function_returning_hash() };
> > #
> > # because I won't get the function's return values put into a
> > # hash, because the stuff inside the { ... } isn't a list of
> > # pairs. Instead I'll get a (reference to) a closure, not at
> > # all the same thing.
>
> You've got a point. There's an easy way to say "I want a sub":
>
> my $sub = -> { ... }
>
> But I can't think of a similarly punctuation-intensive way to say "I want
> a hash." (someone please step in and correct me).
I nominate:
$() == scalar()
%() == hash()
@() == array()
For the above function:
$hashref = %(function_returning_list_which_needs_to_be_hashified());
That would make %() a hash constructor, just like {}.
Ashley Winters
--
When you do the community's rewrite, try to remember most of us are idiots.