Thank you very much Sam and Wade for the response. strict refs mode is fine. But I just wanted to know if I understood right! When you use the -> operator the '$' sigil is not necessary! Perl automatically understands the type i.e whether array or hash.
I personally believe you're right. More precisely, with the symrefs thingy others duly explained to you, the -> dereferentiation operator, complete of the correct parens -AFAICS it doesn't exist by itself- is unambiguous enough for the correct slot to be selected. However you should not use symrefs, anyway. (But under particular circumstances.) Rather, I feel like pointing out that main->{x} = 1; is still valid syntax, under strictures, although it has to be associated with a different semantics than yours:
$ perl -Mstrict -wle ' > my %x; sub main () { \%x }; > main->{x} = 1; > print $x{x}' 1
In reply to Re^3: what does main->{x} = 1 do?
by blazar
in thread what does main->{x} = 1 do?
by ganeshk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |