No, it's not as complicated, €, ¥, £ and ¢ are currency symbols like $. A simple €arr is a scalar which is meant to hold a array_ref. It's identical to $arr! Unlike @arr which has another place in the symbol table, changing $arr also means changing €arr (or ¥arr, there is no typechecking *). Just the dereferencing syntax is different!
€one = @two;
@one = €two;
@one = @two;
€one = €two;
€one = \@two;
# is translated to
$one = @two;
@one = $two;
@one = @two;
$one = $two;
$one = \@two;
> Suppose you have this @¥hash{foo,bar}[2], what does the @ belong to? Is it @{¥hash{foo,bar}}[2] or @{¥hash{foo,bar}[2]}?
the grouping of @€[..] is indented to be the opposit of @$[..], that means "listyfy" the biggest possible part, so it is @ {¥hash{foo,bar}[2]}.
Think of it as
sub aref2list ($) { return @{ $_[0] } }
aref2list($hash->{foo,bar}[2]);
The first alternative can be achieved as you typed it @{¥hash{foo,bar}}[2] which is identical with @{ $hash->{foo,bar} }[2]. You can still use curlies for grouping, just the default grouping was changed. and if you want the old default behavior just write @$hash{foo,bar}[2].
Some remarks::
1. I'd prefer to get rid of this old multi-dimensional hash syntax. With the new sigils there is no need anymore to use it. If we abandon it we can use the notation for slices.
2. I'm not sure anymore if using @€ and %¥ this way is a good choice ... maybe better *€ and *¥, which is closer to perl6. ( or identical? I can't tell ...)
> P.S.: You said you are sometimes using _cref ... looks like you'd need (at least) one more sigil.
Yes, and I think ¢ is a good choice! 8 )
but the benefit of writing ¢coderef(paras) instead of $coderef->(paras) alone doesn't justify this discussion. That's why I'm focussing on arrays and hashes!
PS: There seems to be a bug in the board's software. Occasionally previewing ¥ is translated to Â¥ by the cgi.
Can't reproduce when and why! I have to correct every symbol manually! : (
UPDATE: (*) To be precise, i can't realize typechecking with a codefilter, but I think it's worth thinking about a runtime typechecking and warning, if the scalar in €arr is an array_ref or not. A (slow) solution could be achieved with tieing the scalar and checking with ref when STORE is called. |