in reply to using quotes in hash keys
If you get too ambitious, Perl might think you're making a subroutine reference (i.e. &foo), or are trying to reference an internal function (i.e. delete) In a hash context, for example, Perl "knows" what you mean when you leave a bare 'safe string'. You might do this inside a hash definition:Safe Unsafe ------------------------------------------ foo foo bar -foo --foo foo_bar foo+bar jane3 3jane
Or, inside a hash reference: $hash{key_3} = 'value3'; The same sort of trick applies to where quotation is required in HTML, as you can often get away with no quotes at all if you stick to letters and numbers only.my (%hash) = ( key_1 => 'value1', key_2 => 'value_2' ); print $cgi->textfield(-name => 'input1');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: using quotes in hash keys
by John M. Dlugosz (Monsignor) on Jul 07, 2001 at 21:45 UTC | |
by tadman (Prior) on Jul 08, 2001 at 18:30 UTC | |
by John M. Dlugosz (Monsignor) on Jul 08, 2001 at 21:19 UTC |