Thread Aus einem string einen Wert herausbekommen
(23 answers)
Opened by Forza at 2012-07-10 14:04
ungestestet
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 my %pids = (); for my $line (@lines) { if ($line =~ /Beginne.*pid=(\d+)/) { $pids{$1}++; } elsif ($line =~ /Beende.*pid=(\d+)/) { $pids{$1}--; } } for my $uebrig_pid (keys %pids) { say $pids{$uebrig_pid} if $pids{$uebrig_pid} > 0; } Last edited: 2012-07-10 15:03:25 +0200 (CEST) |