Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
perldata states: Values are usually referred to by name, or through a named reference. So the LHS in $ary = [1,2,3] is a named reference; it is a named variable. The RHS is an anonymous array, at least that is what is called throughout the perl documentation. So let's stick to that to avoid confusion.
Difference between languages, but not in perl. In perl, the scalar $ary may hold an anonymous array. But @ary is a named array. Perl does no implicit derefrencing, and so the syntax to access slots of the named array @ary necessarily has to be distinct from the one to access a slot of the anonymous array stored in the named scalar variable $ary - or of any anonymous array:
So in perl - at least that is how I understand perl for a couple of decades now - the difference is between named and anonymous variables. To get hold of an anonymous variable beyond a single statement, its reference has to be stored in a named scalar variable. But I'm not going on telling you stuff you know as well as I do, only to get reverse 'halb' back, and I won't argue any more, since there is no point but frustration. Let's close this sub-thread. Thank you. update °) or scalars, but this can't be easily written *scalar = \1 is not the same thing Of course not, because that makes a reference from a constant. A variable reference is needed to make it variable:
The expression *scalar = \"foo bar" creates a package constant (readonly package variable) $scalar (but *scalar = \"Hello $world" doesn't, it's r/w :-).
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
In reply to Re^10: Thx, St. Larry, for the Beauty of Sigils
by shmem
|
|