Mitglied seit: 07.08.2005
Forenbeiträge: 1
Besuche: 25
Ich habe schwierigkeiten beim Ausführen des Codes!
Wenn ich zum Beispiel eine Google Datei öffnen möchte:
"perl google.pl ich.html" kommt die Meldung
"cannot open file!" aber die Variable "$ARGV[0]"
sollte "ich.html" als Dateiname interpretiert!?
-------------------HIER DER CODE-------------------------------------
#!/usr/bin/perl
open INFILE, "$ARGV[0]" || die "\n cannot open file!\n";
open OUTFILE, ">>outfile.txt";
$counter = -1;
while (<INFILE>) {
$buf = $_;
$indx = index $buf,"<font color=green>";
if ($indx != -1) {
$indx = $indx + 18;
$result = substr $buf, $indx;
$indx = index $result,"/";
$result = substr $result,0,$indx;
$bool = "no";
foreach $i (@buffa) {
if ($i eq $result) { $bool = "found" };
}
if ($bool eq "no") {
$counter++;
$buffa[$counter] = $result;
print "$result\n";
print OUTFILE "$result\n";
}
}
}
close INFILE;
close OUTFILE;
------------------------END---------------------------
Ich danke für die Antwort!
greets r[z]
Wenn ich zum Beispiel eine Google Datei öffnen möchte:
"perl google.pl ich.html" kommt die Meldung
"cannot open file!" aber die Variable "$ARGV[0]"
sollte "ich.html" als Dateiname interpretiert!?
-------------------HIER DER CODE-------------------------------------
#!/usr/bin/perl
open INFILE, "$ARGV[0]" || die "\n cannot open file!\n";
open OUTFILE, ">>outfile.txt";
$counter = -1;
while (<INFILE>) {
$buf = $_;
$indx = index $buf,"<font color=green>";
if ($indx != -1) {
$indx = $indx + 18;
$result = substr $buf, $indx;
$indx = index $result,"/";
$result = substr $result,0,$indx;
$bool = "no";
foreach $i (@buffa) {
if ($i eq $result) { $bool = "found" };
}
if ($bool eq "no") {
$counter++;
$buffa[$counter] = $result;
print "$result\n";
print OUTFILE "$result\n";
}
}
}
close INFILE;
close OUTFILE;
------------------------END---------------------------
Ich danke für die Antwort!
greets r[z]