in reply to The philosophy behind element reference syntax

I am also new to Perl, but the way I see it is that the prefix tells me whether the result I am going to be playing with is a scalar or a list. Thus...

Something starting with $ is a scalar -- the parentheses or whatever after the identifier tell me that it comes from an array (or hash or whatever), but the value returned is a scalar nonetheless.

Similarly, if there is an @ preceding an identifier, the value I am playing with is a list -- it may be from an array, an array slice, or whathaveyou, but it is still going to be a list.

I'm sure I am oversimplifying, but it's a way of looking at things that works for me in the simple programs I have written so far.

  • Comment on Re: The philosophy behind element reference syntax

Replies are listed 'Best First'.
Re^2: The philosophy behind element reference syntax
by revdiablo (Prior) on Dec 08, 2004 at 18:16 UTC
    I'm sure I am oversimplifying

    Maybe you're not catching every nook and cranny and exception that currently is or ever will be in the language grammar, but your post clearly explains the basic reasoning behind the changing sigils. ++