perl naming convention

Discussion in 'Perl Misc' started by Peng Yu, Nov 26, 2008.

  1. Peng Yu

    Peng Yu Guest

    Hi,

    I'm wondering what is the widely accepted naming convention. In C++,
    boost library recommend

    1. All variables, functions and classes shall not have upper cases.
    2. Macro shall be upper cased.

    I'm wondering what is the convention for perl.

    Thanks,
    Peng
     
    Peng Yu, Nov 26, 2008
    #1
    1. Advertising

  2. Peng Yu <> writes:

    > Hi,
    >
    > I'm wondering what is the widely accepted naming convention. In C++,
    > boost library recommend
    >
    > 1. All variables, functions and classes shall not have upper cases.
    > 2. Macro shall be upper cased.
    >
    > I'm wondering what is the convention for perl.


    In short:

    functions and variables should be lower_case_like_this

    class names/package names should be CamelCase::LikeThis

    constants, (old-style) file handles, formats and package/global
    variables should be UPPER_CASE_LIKE_THIS or $LIKE_THIS

    When you have combinations they Look::Like::THIS or $Like::this etc.

    See for in intro: http://perldoc.perl.org/perlstyle.html

    --
    Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
     
    Joost Diepenmaat, Nov 26, 2008
    #2
    1. Advertising

  3. Peng Yu <> wrote:
    > Hi,
    >
    > I'm wondering what is the widely accepted naming convention. In C++,
    > boost library recommend
    >
    > 1. All variables, functions and classes shall not have upper cases.
    > 2. Macro shall be upper cased.
    >
    > I'm wondering what is the convention for perl.



    perldoc perlstyle


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad J McClellan, Nov 27, 2008
    #3
    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.
Similar Threads
  1. Rick

    Which c# naming convention?

    Rick, Jan 19, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,787
    Paul Glavich
    Jan 19, 2004
  2. dm1608
    Replies:
    6
    Views:
    8,531
  3. Buck Turgidson

    JSP Method Naming Convention

    Buck Turgidson, Mar 2, 2004, in forum: Java
    Replies:
    1
    Views:
    1,757
    P.Hill
    Mar 2, 2004
  4. harry
    Replies:
    2
    Views:
    1,197
    harry
    Dec 8, 2004
  5. Roedy Green

    Naming Convention(s)

    Roedy Green, Sep 3, 2005, in forum: Java
    Replies:
    24
    Views:
    975
    Dale King
    Sep 12, 2005
Loading...

Share This Page