Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Subroutine Bewilderment

by rir (Vicar)
on May 29, 2004 at 13:43 UTC ( [id://357475]=note: print w/replies, xml ) Need Help??


in reply to Subroutine Bewilderment

I will agree with Joost except that you also need to become used to print and similar functions.
print SPECIAL_ARG ordinary_arg_list, with_commas;
This is the only unusual construction that you need to get used to early on. Otherwise arguments are separated by commas.

Generally, just don't use the ampersand prefix and just don't use prototypes.

Regarding predeclaration or definition, use use strict and use warnings and let perl train you.

Your question is a good one and well worth better answers than you are apt to get. The problem is that your question embraces many aspects of Perl syntax and there is no short definitive answer.

There is a lot of sense in Perl. I think you just need to grapple with her for a while and you will get her big picture. Attack smaller bits of your problem and use a more empirical method to learn. Perl is one of the more grown computer languages, versus spec'd; practice is a bigger part of learning due to this.

Knowing the precedence of op's, what defines a list, and what is happening with context; knowing those will help with the issues you ask about.

Be well.

Replies are listed 'Best First'.
Re: Re: Subroutine Bewilderment
by Somni (Friar) on May 29, 2004 at 15:16 UTC
    print SPECIAL_ARG ordinary_arg_list, with_commas;
    This is the only unusual construction that you need to get used to early on. Otherwise arguments are separated by commas.

    The syntax may be a little unusual, mostly because it's not used much except with print and printf, but it isn't unique to those functions. It's just the indirect object syntax, new Foo, frobnicate $foo "bar", etc. It's covered in perlobj, and it is generally to be avoided except with builtins.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://357475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-19 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found