in reply to nested foreach loop not working

$VAR1 is not a hash, it's a reference to an array (of hashes).

It's not clear what part of $responsetextall[$i][$j]{attributeStatements} $VAR1 corresponds to. Can you clarify?

#!/usr/bin/perl use warnings; use strict; my $arr = [ { namespace => 'urn:oasis:names:tc:SAML:2.0:attrname-forma +t:unspecified', name => 'First Name', values => '[user.firstName]', type => 'EXPRESSION' }, { namespace => 'urn:oasis:names:tc:SAML:2.0:attrname-forma +t:unspecified', name => 'Last Name', values => '[user.lastName]', type => 'EXPRESSION' } ]; for my $hash (@$arr) { print "$hash->{type}\t"; print "$hash->{values}\n"; }
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: nested foreach loop not working
by Annie17 (Initiate) on Dec 21, 2021 at 12:26 UTC

    $VAR1 contains the output of attributestatements.while printing the values of hash , it is giving the result of only the last hash of array not all. how to loop through it to print all the values

      I'm getting the following output:
      EXPRESSION [user.firstName] EXPRESSION [user.lastName]
      i.e. it contains all the "values". What output do you need instead?

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]