you are right, it's possible to use my $var; in non-void context, actually I'm regularly prepending warn for debugging.°
> While these features remain experimental, they're rather unwieldy and probably easy to get wrong:
They are indeed not nice to activate, I'd probably write a module bundling those four steps to avoid boilerplate.
But the feature is very nice in many circumstances, Brian d Foy² lists some here:
it's also very handy when working with aliases, and one doesn't want to litter ones code with cryptic $_[N°]
D:\tmp\pm>perl -Mfeature=:all -M-warnings sub uc_name { my \$name = \$_[0]; $name = uc $name } $n="ken"; uc_name($n); say $n __END__ KEN
FWIW Perl4 had an aliasing feature with *type-globs, but this was restricted to package vars.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) actually I'm even putting the warn into the line before, like this I'm flexible with (un)commenting it.
# warn my $x = ...;
²) corrected spelling twice (= deux fois ;)
In reply to Re^2: POD for use feature 'declared_refs' wrong
by LanX
in thread POD for use feature 'declared_refs' wrong
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |