Re: store Array in hash ?



Mr. Shawn H. Corey wrote:
On Wed, 2006-29-03 at 23:45 -0800, John W. Krahn wrote:
Michael Gale wrote:
Hello,
Hello,

I have setup a hash like the following:

my $test;

$test->{$setup}->{'opt'} = "OK";
Or:

my $test = { $setup => { opt => 'OK' } };

Or:
my $test{$setup}{opt} = 'OK';

Did you actually try that?

$ perl -le'my $test{$setup}{opt} = q[OK]; print $test{$setup}{opt}'
syntax error at -e line 1, near "$test{"
Execution of -e aborted due to compilation errors.



John
--
use Perl;
program
fulfillment
.



Relevant Pages

  • Re: javascript works in IE, not in firefox
    ... And Randy is correct in stating that document.wirte does not work at all in XHTML DOMs, but that is not a factor here as the page is served to Firefox browsers with a text/html content type header so whatever the mark-up may resemble it is always being interpreted as tag soup HTML. ... The specification defines the syntax for the language, but it also allows for extensions, and for more tolerant interpretations of the syntax (this means that an ECMAScript implementation must provide everything specified by ECMA 262 but may provide more, and an implementation may elect to cope with some ECMA 262 syntax errors as if they were not errors but it is not allowed to treat anything that is valid by ECMA 262 as an error). ... It is a syntax error because the two distinct syntax units from which an ECMAScript Program is constructed are Statements and FunctionDeclarations, and as a result you cannot put a FunctionDeclarations inside a Statement. ... When javascript is executed FunctionDeclarations are acted upon prior to the execution of any Statements in the pertinent execution context. ...
    (comp.lang.javascript)
  • Re: statement values
    ... You will get a syntax error with ... are only different that the firs one gives enough info to parser to ... sequence of valid tokens and gives syntax errors if no way, ... execution stage when the engine is actually trying to execute ...
    (comp.lang.javascript)
  • Re: Legacy code/browser compatibility
    ... function foo() { ... The actual command that is a syntax error is, of course, not executed. ... Now imagine that foo() has been called from within your page, ... error and code execution stops. ...
    (comp.lang.javascript)
  • Re: Legacy code/browser compatibility
    ... There is no syntax error in that code. ... Let's see a real syntax error and its influence on code execution before ... element containing them will not result in executable script. ... In this case, foo() does get executed, even though it has a syntax ...
    (comp.lang.javascript)
  • Re: [f77] Choosing a complete path
    ... I think it should be a syntax error. ... >that the character string you pass to the OPEN command has spaces in it? ... Not that either (although execution may, ...
    (comp.lang.fortran)