in reply to Re^10: How can I avoid code repetition here
in thread How can I avoid code repetition here
Compare:
Lacking the _ prototype, you original code would not work for the case of lexical $_ not in the same scope as the function definition.sub f {say @_ ? $_[0] : $_} sub g (_) {say @_ ? $_[0] : $_} $_ = "outer"; { my $_ = "inner"; f; g; } __END__ outer inner
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: How can I avoid code repetition here
by rovf (Priest) on Oct 12, 2009 at 11:10 UTC | |
by JavaFan (Canon) on Oct 12, 2009 at 11:17 UTC | |
by rovf (Priest) on Oct 12, 2009 at 11:24 UTC |