Schrift
[thread]755[/thread]

hash einer funktion übergeben (Seite 3)



<< |< 1 2 3 >| >> 24 Einträge, 3 Seiten
mr-sansibar
 2006-06-21 18:27
#8060 #8060
User since
2006-04-13
90 Artikel
BenutzerIn
[default_avatar]
danke das ihr mir soviel ratschläge gibt, aber irgendwie komme ich nicht weiter.

kann mal zeigen was ich bis jetzt geschrieben habe:
Code: (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
32
33
34
my $write_file = "c:/trxlogfile.txt";

my $fh = new IO::File;
if ($fh->open("> $write_file")) {


#open(OUT, ">$write_file" ) || die "Kann die Datei nicht erzeugen: $!";

my @array_result;
my $string_result;
my %hash;

foreach (@ARGV) {

$string_result=work_with_file($_, $fh, \%hash);
push(@array_result, $string_result);

}

foreach my $key (sort keys %hash) {
print $fh "$key:\n$hash{$key}\n\n";
}


#my $laenge = @ARGV;


for my $i (0..$#ARGV){
print $fh "$ARGV[i]\n\n $array_result[i]\n";
}
}


$fh->close;


bekomme diese fehlermeldung:
Argument "i" isn't numeric in array element at C:\trxLogParser_2006-06-14.pl l
Bareword "i" not allowed while "strict subs" in use at C:\trxLogParser_2006-06
Execution of C:\trxLogParser_2006-06-14.pl aborted due to compilation errors.\n\n

<!--EDIT|mr-sansibar|1150900095-->
zipster
 2006-06-21 18:33
#8061 #8061
User since
2004-09-06
458 Artikel
BenutzerIn
[default_avatar]
Muss das nicht so sein?
Code: (dl )
1
2
3
for my $i (0..$#ARGV){
print $fh "$ARGV[$i]\n\n $array_result[$i]\n";
}
mr-sansibar
 2006-06-21 18:45
#8062 #8062
User since
2006-04-13
90 Artikel
BenutzerIn
[default_avatar]
stimmt danke
Strat
 2006-06-21 20:47
#8063 #8063
User since
2003-08-04
5246 Artikel
ModeratorIn
[Homepage] [default_avatar]
hilft es dir vielleicht weiter, wenn du an den anfang des scriptes ein
Code: (dl )
1
2
3
4
#! /usr/bin/perl
use warnings;
use strict;
use diagnostics;

schreibst? das diagnostics versucht, die manchmal doch etwas kryptischen Perl-Fehlermeldungen und Warnungen zu erklaeren.
perl -le "s::*erlco'unaty.'.dk':e,y;*kn:ai;penmic;;print"
http://www.fabiani.net/
<< |< 1 2 3 >| >> 24 Einträge, 3 Seiten



View all threads created 2006-06-16 14:08.