In article 1195995 I got it work with your help to build
an array of hashes.
Now I want to get out a whole array of it, but it is always
empty.
What is going wrong with it?#!/usr/bin/perl -w use strict; use warnings; my %hierhash; my @feld; my @hashfeld; my $wert; my @array; @hashfeld = (); %hierhash = &dofn(0,5,1); print "1 $hierhash{'var2'}[3] \n"; push @hashfeld, {%hierhash}; %hierhash = &dofn(0,5,2); print "2 $hierhash{'var2'}[3] \n"; push @hashfeld, {%hierhash}; $wert = $hashfeld[0]->{'var2'}[3]; print "$wert\n"; $wert = $hashfeld[1]->{'var2'}[3]; print "$wert\n"; @array = (); @array = $hashfeld[1]->{'var2'}; print "array $array[3]\n"; # ################################################ # holt die fn Werte # ################################################ sub dofn { my $i; my ($ivon, $ibis, $imal) = @_; my %hashfn; 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; }
Regards, Buchi
In reply to How to get out an array of a hash? by buchi2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |