hab hier leider noch eine frage zu:
folgendes beispiel funktioniert
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;
my $count = 0;
my @unsort_array = (<DATA>);
my @sort_array = sort @unsort_array;
foreach (@sort_array){++$count; print "$count. $_";}
RESA_BRU_BRU2CK0204 on IA W2K-FRAPIC-AP03_3083
RESA_BRU_BRU1LHBOCBD1 on IA W2K-FRAPIC-AP05_3083
SITA_PAD_PAD1CKB010 on IA W2K-FRAPIC-AP06_3083
RESA_BRU_BRU1GTA63M on IA W2K-FRAPIC-AP06_3081
RESA_BRU_BRU1CK0203 on IA W2K-FRAPIC-AP06_3081
ARINC_BHX_BHXCK047 on IA W2K-FRAPIC-AP04_3083
SITA_FRA_FRAA2ALH03 on IA W2K-FRAPIC-AP02_3083
SITA_FRA_FRAB2BC340 on IA W2K-FRAPIC-AP02_3081
CAMPUS_FRA_PMS01 on IA W2K-FRAPIC-AP02_3081
ARINC_BHX_BHXCK050 on IA W2K-FRAPIC-AP04_3081
CAMPUS_FRA_PMS01 on IA W2K-FRAPIC-AP03_3081
SITA_FRA_FRAA2AC282 on IA W2K-FRAPIC-AP03_3081
RESA_BRU_BRU2CK0202 on IA W2K-FRAPIC-AP03_3081
RESA_BRU_BRU1CK0205 on IA W2K-FRAPIC-AP01_3083
RESA_BRU_BRU1CK0201 on IA W2K-FRAPIC-AP01_3083
CAMPUS_FRA_PMS01 on IA W2K-FRAPIC-AP01_3081
CAMPUS_MUC_WS646129 on IA W2K-FRAPIC-AP01_3081
SITA_FRA_FRAB2BC338 on IA W2K-FRAPIC-AP01_3081
SITA_FRA_FRAB2BC342 on IA W2K-FRAPIC-AP01_3081
die daten werden sortiert und der zähler geht auch
aber wenn ich das array nicht durch data fülle sondern durch
mein programm dann geht es nicht mehr der Zähler bleibt auf
1 und es erfolgt keine sortierung warum?
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
32
33
34
35
sub con_cli
{
my ($w1,$w) = @_;
my @w2 = $w1;
my $cli_str;
for my $cli(@w2)
{
open(CLI_HTML,"<$cli") or die $!;
while ($cli_str = <CLI_HTML>)
{
if($cli_str =~ s/<tr><td>CLIENTS=\s*(.+)<\/td><\/tr>/$1/){
my @cli_str = split ' ', $cli_str;
for $cli(@cli_str)
{
my @wks = split ' ', $cli;
for my $cli2(@wks)
{
my @wks = split 'pixxadm', $cli2;
my @unsort_array = ("@wks\t\ton IA\t\t$w\n") if @wks;
&output(@unsort_array);
}
}
}
}
}
}
close CLI_HTML;
sub output
{
my (@unsort_array) = @_;
my $count = 1;
my @sort_array = sort @unsort_array;
foreach (@sort_array){++$count; print "$count. $_";}
}
warum ist das so?