#!/usr/bin/perl -w use strict; my %x; @x{('a', 'b', 'c')} = (4, 5, 6); my $x = \%x; print @$x{'a'}, $/; print @x{'a'}, $/; print @x{('a')}, $/; print @x{'a',}, $/; exit 0; __END__ $ ./japhy.pl Scalar value @x{'a'} better written as $x{'a'} at ./japhy.pl line 7. 4 4 4 4 #### 1: case '@': 2: if (PL_expect == XOPERATOR) 3: no_op("Array", s); 4: PL_tokenbuf[0] = '@'; 5: s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE); 6: if (!PL_tokenbuf[1]) { 7: if (s == PL_bufend) 8: yyerror("Final @ should be \\@ or @name"); 9: PREREF('@'); 10: } 11: if (PL_lex_state == LEX_NORMAL) 12: s = skipspace(s); 13: if ((PL_expect != XREF || PL_oldoldbufptr == PL_last_lop) && intuit_more(s)) { 14: if (*s == '{') 15: PL_tokenbuf[0] = '%'; 16: /* Warn about @ where they meant $. */ 17: if (ckWARN(WARN_SYNTAX)) { 18: if (*s == '[' || *s == '{') { 19: char *t = s + 1; 20: while (*t && (isALNUM_lazy_if(t,UTF) || strchr(" \t$#+-'\"", *t))) 21: t++; 22: if (*t == '}' || *t == ']') { 23: t++; 24: PL_bufptr = skipspace(PL_bufptr); 25: Perl_warner(aTHX_ packWARN(WARN_SYNTAX), 26: "Scalar value %.*s better written as $%.*s", 27: t-PL_bufptr, PL_bufptr, t-PL_bufptr-1, PL_bufptr+1); 28: } 29: } 30: } 31: } 32: PL_pending_ident = '@'; 33: TERM('@'); #### if (*s == '$' && s[1] && (isALNUM_lazy_if(s+1,UTF) || strchr("${", s[1]) || strnEQ(s+1,"::",2)) ) { return s; } #### *d = '\0'; d = dest; if (*d) { if (PL_lex_state != LEX_NORMAL) PL_lex_state = LEX_INTERPENDMAYBE; return s; }