in reply to perlsub prototype sub(_) sub foo(_)

Whats wrong with the documentation?

Cheers Rolf

( addicted to the Perl Programming Language)

  • Comment on Re: perlsub prototype sub(_) sub foo(_)

Replies are listed 'Best First'.
Re^2: perlsub prototype sub(_) sub foo(_)
by farang (Chaplain) on Jun 30, 2013 at 13:30 UTC

    If you are referring to my node, there's probably nothing wrong with the documentation, just my quick reading of it. When it says you can use _ in place of $ I got the idea that prototypes (_) and ($) would be the same, which is not the case.

    sub foo(_){ warn @_ } sub goo($){ warn @_ } foo(); goo();
    output:
    Not enough arguments for main::goo at pm3 line 4, near "()"
    Execution of pm3 aborted due to compilation errors.

Re^2: perlsub prototype sub(_) sub foo(_)
by Anonymous Monk on Jun 30, 2013 at 14:00 UTC

    Whats wrong with the documentation?

    It didn't show up in the search :)

    It doesn't mention  (_) and  (_) is not on the list Declared as            Called as

      TIP: a file-search in perlsub#Prototypes for  _ (surrounded by spaces) helps! =)

      Cheers Rolf

      ( addicted to the Perl Programming Language)