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

A

Anil A Kumar

I saw some where:

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

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

-Anil
 
W

Willem

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
 
J

Jürgen Exner

Anil A Kumar said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top