Astrid
unread,Jul 25, 2017, 3:44:18 AM7/25/17You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hallo!
Habe ein Hash, der Arrays enthaelt.
Den Hash habe ich wieder in ein Array gepackt.
Wie greife ich aber nun auf so ein Element zu?
Ein Testbeispiel (das eigentliche Programm ist
komplexer).
#!/usr/bin/perl -w
my %hierhash;
my @hashfeld;
@hashfeld = ();
%hierhash = &dofn(0,5,1);
print "$hierhash{'var2'}[3] \n";
push(@hashfeld,%hierhash);
%hierhash = &dofn(0,5,2);
print "$hierhash{'var2'}[3] \n";
push(@hashfeld,%hierhash);
print $hashfeld[1]{'var2'}[3];
print "\n";
sub dofn () {
my ($i, $ivon, $ibis, $imal);
my %hashfn;
$ivon = $_[0];
$ibis = $_[1];
$imal = $_[2];
for ($i = $ivon; $i < $ibis; $i++) {
push(@{$hashfn{'var1'}}, $i*$imal);
push(@{$hashfn{'var2'}}, $i*$imal*10.);
push(@{$hashfn{'var3'}}, $i*$imal*20.);
}
return %hashfn;
}
Gruss, Astrid