1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use strict;
use warnings;
my @treffer;
my $suche = 1;
my $spalte = 5;
my @zeilen = (
"120\t0\t1\t1\t0\t1\t0.5\t12",
"130\t1\t0\t0\t0\t0\t0.4\t8",
"130\t1\t0\t0\t0\tD\t0.4\t8",
);
while (defined (my $line = shift @zeilen)) {
my $wert = (split/\t/, $line)[$spalte];
push @treffer, $wert
if $wert =~ /^$suche$/;
# hier verwende ich mit Absicht nicht $wert == $suche,
# denn falls $wert keine Zahl ist, wuerde '==' einen
# Fehler ausloesen
}
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.