Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: nested foreach loop not working

by choroba (Cardinal)
on Dec 21, 2021 at 10:26 UTC ( [id://11139799]=note: print w/replies, xml ) Need Help??


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]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139799]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-16 11:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found