Hash ed array
Una raccolta di metodi pratici per lavorare su array ed hash in PERL.
Stampare un hash
@keys = keys(%myhash);
foreach $k (@keys) {
print "<li>The key '$k' has value '".$myhash{$k}."'";
}Stampare array di hash
@keys = keys(%{@hashes[1]});
print join("<li>",@keys);
foreach $k (@keys) {
print "<li>The key $k has value ".$hashes[1]{$k};
}Inizializzare hash di array di hash
%component_tree = (
component1 => [
{name => "command1", id=> "001"},
{name => "command2", id=> "002"},
{name => "command3", id=> "003"},
{name => "command4", id=> "004"}
],
component2 => [
{name => "command5", id=> "011"},
{name => "command6", id=> "012"},
{name => "command7", id=> "013"},
{name => "command8", id=> "014"}
]
);Inizializzare hash di hash
%component_tree = (
component1 => {
name => "command1",
id => "001"
},
component2 => {
name => "command1",
id => "001"
}
);Notes
Publication details
Category: Perl
Published by: loryzz on date: 06.01.2008 21:24:01
Last edit by: loryzz on date: 21.01.2009 11:28:35
Ratings
Leave a comment
All comments must be approved by site administrator.
Please write comments on topic. Spam will be never approved.
Perl: Linked articles
Invio mail published by loryzz in Perl
























Ritorna all'inizio
Based total comments
0 %
Comments percentage
0 %