Different methods to call a subroutine!

Discussion in 'Perl Misc' started by pod69@gmx.net, Dec 28, 2006.

  1. Guest

    Hello,

    Is there any difference if i call a subroutine wit subroutine() or
    &subroutine() - whats the different with the "&"!
    Can anyone tell me that?

    thx
     
    , Dec 28, 2006
    #1
    1. Advertising

  2. kens Guest

    wrote:
    > Hello,
    >
    > Is there any difference if i call a subroutine wit subroutine() or
    > &subroutine() - whats the different with the "&"!
    > Can anyone tell me that?
    >
    > thx


    Take a look at the documentation:

    perldoc perlsub

    Ken
     
    kens, Dec 28, 2006
    #2
    1. Advertising

  3. Dr.Ruud Guest

    schreef:

    > Is there any difference if i call a subroutine wit subroutine() or
    > &subroutine() - whats the different with the "&"!
    > Can anyone tell me that?


    See perlsub.

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, Dec 28, 2006
    #3
  4. Paul Lalli Guest

    wrote:
    > Is there any difference if i call a subroutine wit subroutine() or
    > &subroutine() - whats the different with the "&"!
    > Can anyone tell me that?


    Everyone so far has instructed you to read `perldoc perlsub`. That's
    good advice. To help you narrow it down, the shortest answer is:

    & disables prototype-checking and passes the current @_.

    Search for "prototype" and "@_" within perlsub for more details.

    Paul Lalli
     
    Paul Lalli, Dec 28, 2006
    #4
  5. <> wrote:


    > Is there any difference if i call a subroutine wit subroutine() or
    > &subroutine() -



    Yes.


    > whats the different with the "&"!



    You are expected to check the Perl FAQ *before* posting to
    the Perl newsgroup.

    perldoc -q "&"

    What’s the difference between calling a function as &foo and foo()?


    (which also answers the difference between &foo() and foo() )


    > Can anyone tell me that?



    Anyone with the courtesy to check the FAQ could.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Dec 29, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page