Whats the way of wildcard HoH extraction?

I

ipellew

Hi all;

Whats the methodology of getting the Values() out of a HoH using a
wildcard?

EG
From my HoH Fragment:-
$VAR1 = {
iterate => { ...etc....
'S000' => { 'value' => '1|2|3' },
'it_1' => { 'value' => '<td>color number&nbsp;<?S?></td>' },
'Smax' => { 'value' => 3 },
'C000' => { 'value' => 'red|blue|green' },
'it_0' => { 'value' => '<tr>color=C<?C?><?iterate _0?></tr>'
},
'C001' => { 'value' => 'black|white|cyan' },
..... etc
}, ......
}

foreach ($VAR1->{iterate}->{it_*}) {
..... Code .....
}

Regards
Ian
 
G

Gunnar Hjalmarsson

Whats the methodology of getting the Values() out of a HoH using a
wildcard?

foreach ($VAR1->{iterate}->{it_*}) {
.... Code .....
}

To my knowledge you don't use wildcards in Perl that way; you use a
regular expression.

foreach ( grep /^it_/, keys %{ $VAR1->{iterate} } ) {
print "Key: $_\n",
"Value: $VAR1->{iterate}->{$_}->{value}\n\n";
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top