in reply to Re^3: call external sub ref from method in single line
in thread call external sub ref from method in single line
... does a pair of parentheses () also count as a “subscript”?
I've always assumed this is so and I've never encountered a counterexample, but this may just be because I almost always, if not always, use the
$reference->{any}[$number]{of}[$levels]->();
form; it seems more clear and the other form makes me just a bit nervous.
Update: Perhaps my fondness for the form exemplified above has to do with the fact that I will often try to shorten and self-document my code by using intermediate variables:
my $cr_that_does_something = $reference->{any}[$number]{of}[$levels];
...
$cr_that_does_something->('foo');
...
$cr_that_does_something->('bar');
The -> arrow is, of course, always needed here (if you don't use a sigil!).
Give a man a fish: <%-{-{-{-<
|
|---|