Thread Suchen im Array!?
(5 answers)
Opened by GAST at 2009-04-08 14:09
meinst du sowas?
Code (perl): (dl
)
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 29 30 31 #!/usr/bin/perl use strict; use warnings; my @array = ( 'Dut No', 'asdf', 'asdf', 'asdf', 'Dut No', 'yxcv', 'yxcv', 'yxcv', 'yxcv', 'Dut No', 'fhgj', 'fhgj', 'fhgj'); my $count = 0; my $in_dut_no = undef; foreach my $item (@array){ if ($item eq "Dut No"){ $in_dut_no = 1; $count++; print "\nDut No ($count)\n"; } elsif ($in_dut_no){ print "$item\n"; } } Gerade weil wir alle in einem Boot sitzen, sollten wir froh sein, dass nicht alle auf unserer Seite sind
|