$hash{$key} = [ @array ];
1 2 3 4 5 6 7 8
foreach my$key (sort {$hash{$a}->[0] <=> $hash{$b}->[0]}keys%hash) { print "$key: "; foreach my $val (@{$hash{$key}}) { print "$val "; } print "\n"; }
my %hash = %{ dateilesen() };
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
use strict; use warnings; #!usr/bin/perl print "here I start \n"; do "Datei_mit_Subroutine.pl"; my %hash = %{dateilesen()}; print "here is the return value of dateilesen:\n"; foreach my$key (sort {$hash{$a}->[0] <=> $hash{$b}->[0]}keys%{$hash}) { print "$key: "; foreach my $val (@{$hash{$key}}) { print "$val "; } print "\n"; }
foreach my$key (sort {$hash{$a}->[0] <=> $hash{$b}->[0]}keys %hash)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!usr/bin/perl use strict; use warnings; print "here I start \n"; do "Datei_mit_Subroutine.pl"; my %hash = %{dateilesen()}; print "here is the return value of dateilesen:\n"; foreach my $key (sort {$hash{$a}->[0] <=> $hash{$b}->[0]} keys(%hash) ) { print "$key: "; print join(' ', @{$hash{$key}}); print "\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!usr/bin/perl use strict; use warnings; print "here I start \n"; do "Datei_mit_Subroutine.pl"; my $hash = dateilesen(); print "here is the return value of dateilesen:\n"; foreach my $key (sort {$hash->{$a}->[0] <=> $hash->{$b}->[0]} keys(%$hash) ) { print "$key: "; print join(' ', @{$hash->{$key}}); print "\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!usr/bin/perl use strict; use warnings; sub dateilesen { my %hash; $hash{a}=[0,'TEST1']; $hash{b}=[1,'TEST2']; $hash{c}=[2,'TEST3']; $hash{d}=[3,'TEST4']; return \%hash; }
1
2
3
4
5
6
here I start
here is the return value of dateilesen:
a: 0 TEST1
b: 1 TEST2
c: 2 TEST3
d: 3 TEST4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use strict; use warnings; #!usr/bin/perl print "here I start \n"; do "Datei_mit_Subroutine.pl"; my %hash = %{dateilesen()}; print "here is the return value of dateilesen:\n"; foreach my$key (sort {$hash{$a}->[0] <=> $hash{$b}->[0]}keys %hash) { print "$key: "; foreach my $val (@{$hash{$key}}) { print "$val "; } print "\n"; } sub dateilesen { my %hash; $hash{h12} = [qw/121 122 123/]; $hash{h15} = [qw/151 152 153/]; \%hash; }
1
2
3
4
here I start
here is the return value of dateilesen:
h12: 121 122 123
h15: 151 152 153
QuoteJo, mein Hash ist in Ordnung.