Hallo ReneeWenn ich Dein Script einfüge kommt mir die nachfolgende Fehlermeldung... Ich weiss leider noch nicht wie die Variable $fh zustandekommt.. Und $line - ist das einfach Zeilenweise abarbeiten?
Zuerst das Script und dann die Fehlermeldung.
#!/usr/bin/perl -w
use strict;
my $Verzeichnis = "/u/test";
opendir(my $dh, $Verzeichnis) || die "$Verzeichnis: $!";
open (my $fh, "$_") or die $!;
while my $line(<$fh>){
my ($datum, $zeit) = split(';',$line);
print $datum;
print $zeit;
# mach was mit $datum und $zeit
}
close $fh;
while(my $filename = readdir($dh)) {
if($filename =~ /.+\.txt*/) {
my $fullpath = "$Verzeichnis/$filename";
open(my $fh, $fullpath) or die $!;
# mach was
close $fh;
}
}
closedir($dh);
Meldung:
"my" variable $datum masks earlier declaration in same scope at aktuell.pl line 12.
"my" variable $zeit masks earlier declaration in same scope at aktuell.pl line 13.
syntax error at aktuell.pl line 10, near "while my "
Global symbol "$line" requires explicit package name at aktuell.pl line 10.
syntax error at aktuell.pl line 15, near "}"
Execution of aktuell.pl aborted due to compilation errors.
Danke zum voraus.
Gruss
Datum: 02.08.2005-22:05
