in reply to Re^4: Passing a value to Mojo::Template template
in thread Passing a value to Mojo::Template template

wat?
  • Comment on Re^5: Passing a value to Mojo::Template template

Replies are listed 'Best First'.
Re^6: Passing a value to Mojo::Template template
by perlfan (Parson) on Apr 15, 2021 at 00:44 UTC
    my %hash = { key1 => q{123}, key2 => q{456}, }; my $h_ref1 = \%hash; my $h_ref2 = { key3 => q{789}, key4 => q{abc}, };

      I think this is an example of how creating a hash and obtaining a reference to it is just as easy as creating a reference to an anonymous hash, but the first example has a bug ({...} should be (...)).

      This:

      my %hash = { key1 => q{123}, key2 => q{456}, }; my $h_ref1 = \%hash;

      ...should be:

      my %hash = ( key1 => q{123}, key2 => q{456}, ); my $h_ref1 = \%hash;

      Dave