Matija Papec writes:
> 
> Would there be a way to still use simple unquoted hash keys like in old 
> days ($hash{MYKEY})?
> 
> imho %hash<<MYKEY>> at first sight resembles alien ship from 
> Independence day. :)

Of course there's a way to do it.  This is one of those decisions that I
was against for the longest time, until one day something clicked and it
made sense.

So I can certainly understand why you don't like it.

You might do it something like this:

    macro postcircumfix:{} ($base, $subscript)
        is parsed( / $?subscript := (\w+) /)
    {
        return { $base.{"$subscript"} }
    }

Whether that actually works depends on whether macros are applied until
one C<is parsed> matches.  If not, then you'll have to do it some other
way:

    macro postcircumfix:{} ($base, $subscript)
    {
        if $subscript.text ~~ /^ \w+ $/ {
            return { $base.{"$subscript"} };
        }
        else {
            no macros 'postcircumfix:{}';  # make sure this isn't
                                           # interpreted by the macro
            return { $base.{$subscript} };
        }
    }

Luke

Reply via email to