in reply to Re^10: How can I avoid code repetition here
in thread How can I avoid code repetition here

You're missing the case where $_ is defined in an inner scope.

Compare:

sub f {say @_ ? $_[0] : $_} sub g (_) {say @_ ? $_[0] : $_} $_ = "outer"; { my $_ = "inner"; f; g; } __END__ outer inner
Lacking the _ prototype, you original code would not work for the case of lexical $_ not in the same scope as the function definition.

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
    Lacking the _ prototype
    Again something new I learned about Perl 5.10! Thanks a lot for telling me...

    -- 
    Ronald Fischer <ynnor@mm.st>
      I did mention the _ prototype both in text and code in my first reply in this thread.
        Point taken!!! And of course ++ for your node ....

        -- 
        Ronald Fischer <ynnor@mm.st>