7 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
for $line (@lines) {
$key=xxx;
$value=yyy;
if defined($hash{key} {
#add value to array
} else {
$hash{key}=\[$value]
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
use warnings;
use strict;
my $daten;
my @tables = qw(Tabelle1.Spalte1 Tabelle1.Spalte2 Tabelle1.Spalte3
Tabelle2.Spalte1 Tabelle2.Spalte2 Tabelle2.Spalte3
Tabelle3.Spalte1);
for (@tables) {
my ($a, $b) = split(/\./, $_);
push @{$daten->{$a}}, $b;
}
for (keys (%$daten)) {
print "Groesse des Arrays für $_: ", scalar(@{$daten->{$_}}), "\n";
print $_,"\n";
print "--", $_, "\n" for (@{$daten->{$_}});
}
exit();
1
2
3
4
5
6
7
8
9
for $line (@lines) {
$key=xxx;
$value=yyy;
if defined($hash{key} {
#add value to array
} else {
$hash{key}=\[$value]
}
}
push $hash{$key}, $value;
push $hash{$key}, $value;
push $hash{$key}, $value;
1
2
3
$ perl -wle'push $hash{key}, 23;'
Type of arg 1 to push must be array (not hash element) at -e line 2, near "23;"
Execution of -e aborted due to compilation errors.
7 Einträge, 1 Seite |