difference between $ and @

V

vimal

hi monks,

i am new to perl. i just want to know the difference between @ and $
prefixes for variables.

when should i use $ and @ as prefix.
an example may be a little useful :)


regards,

vimal
 
T

Tad J McClellan

vimal said:
Thats a cool one and now i got that.


If you had perl installed, then you already had that, as perl ships
and installs that document, along with a boatload of other docs.
 
J

Jürgen Exner

vimal said:
hi monks,

What does religious asceticism have to do with Perl?
i am new to perl. i just want to know the difference between @ and $
prefixes for variables.

See the first page or so of perldoc perldata. It is a rather terse but
well-written introduction into that subject matter.
when should i use $ and @ as prefix.

Use $ whenever you are talking about a single value aka scalar. Use @ when
you are talking about a collection of values which is indexed by consecutive
natural numbers.
an example may be a little useful :)

perldoc perldata has numerous examples.

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top