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

Sorry for the short code sample there, but you did answer it, thank you. The only downside of it, is that it will add more complexity to extract the data to the template file, right?
  • Comment on Re^4: Passing a value to Mojo::Template template

Replies are listed 'Best First'.
Re^5: Passing a value to Mojo::Template template
by choroba (Cardinal) on Apr 14, 2021 at 20:09 UTC
    No. Hash reference is a hash reference, regardless whether it's an anonymous one or a reference to a named hash.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^5: Passing a value to Mojo::Template template
by Anonymous Monk on Apr 14, 2021 at 18:20 UTC
    wat?
      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