need help in perl arrays (New to perl but know TCL well)

Discussion in 'Perl Misc' started by Anil A Kumar, Aug 3, 2011.

  1. Anil A Kumar

    Anil A Kumar Guest

    I saw some where:

    my @options = ("value1!", "value2:s", "value3:s@", "value4:s%");

    I would like to know what this !, @, % characters represent here?

    -Anil
    Anil A Kumar, Aug 3, 2011
    #1
    1. Advertising

  2. Anil A Kumar

    Willem Guest

    Anil A Kumar wrote:
    ) I saw some where:
    )
    ) my @options = ("value1!", "value2:s", "value3:s@", "value4:s%");
    )
    ) I would like to know what this !, @, % characters represent here?

    They represent nothing special here. I assume that later they are
    being used by some function that assigns special meaning to them.

    In this case, they look very familiar to Getopt::Long.

    Look at: perldoc Getopt::Long


    SaSW, Willem
    --
    Disclaimer: I am in no way responsible for any of the statements
    made in the above text. For all I know I might be
    drugged or something..
    No I'm not paranoid. You all think I'm paranoid, don't you !
    #EOT
    Willem, Aug 3, 2011
    #2
    1. Advertising

  3. Anil A Kumar <> wrote:
    >I saw some where:
    >
    >my @options = ("value1!", "value2:s", "value3:s@", "value4:s%");
    >
    >I would like to know what this !, @, % characters represent here?


    The first @ is a sigil to indicate that the variable options is an
    array.
    The others are just ordinary characters in a text.
    However if e.g. you had "value3:mad:s" then the @ would indicate content of
    the array variable s because the string is in double quotes. Therefore
    it would have been better style to use single instead of double quotes,
    because then you would not have to wonder, if the author meant the
    literal s@ or maybe the variable @s.

    jue

    jue
    Jürgen Exner, Aug 3, 2011
    #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. Philipp
    Replies:
    21
    Views:
    1,101
    Philipp
    Jan 20, 2009
  2. Andries

    I know, I know, I don't know

    Andries, Apr 23, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    215
    Gregory Toomey
    Apr 23, 2004
  3. Mumia W.

    Inline::Tcl vs. Inline::Tcl

    Mumia W., Aug 23, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    127
    Mumia W.
    Aug 23, 2006
  4. johannes falcone
    Replies:
    0
    Views:
    168
    johannes falcone
    May 10, 2013
  5. Seetha K S
    Replies:
    0
    Views:
    47
    Seetha K S
    Feb 12, 2014
Loading...

Share This Page