[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
[an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]![]() |
![]() |
![]() |
|||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
![]() |
![]() |
![]() |
Nu er jeg nybegynder i perl så jeg forstår ikke helt svaret. Jeg har brugt denne kode til at søge i en lokal fil og det virker perfekt. Nu skal jeg læse filen (txttv.csv) fra en anden server på www, og har så prøvet med $file3name = 'http://xxx.xxx.xxx/txttv.csv'; men det virker ikke, er der nogen der kan hjælpe mig. Her er et uddrag af den oprindelige kode. $file3name = 'txttv.csv'; &open_file3("FILE1","",$file3name); $line = &read_file3("FILE1"); while (($line = &read_file3("FILE1"))) { @table3data = split(/\s*\;\s*/,$line ,$fields - 10); { for ($x=0;$x < @table3data;$x++) { } ################## DETTE ER KUN ET UDDRAG ######################## if ($event1 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^1$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h01 = $table3data[7];$u01 = $table3data[8]; if ($table3data[4] ne "U"){$status01 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status01 = "SLUT"; $tegn01 = "1"; $odds01 = $table3data[5]; $rodds01 = $table3data[9];}if ($table3data[4] eq "X"){$status01 = "SLUT"; $tegn01 = "X"; $odds01 = $table3data[5]; $rodds01 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status01 = "SLUT"; $tegn01 = "2"; $odds01 = $table3data[5]; $rodds01 = $table3data[9];}}}} if ($event2 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^2$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h02 = $table3data[7];$u02 = $table3data[8]; if ($table3data[4] ne "U"){$status02 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status02 = "SLUT"; $tegn02 = "1"; $odds02 = $table3data[5]; $rodds02 = $table3data[9];}if ($table3data[4] eq "X"){$status02 = "SLUT"; $tegn02 = "X"; $odds02 = $table3data[5]; $rodds02 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status02 = "SLUT"; $tegn02 = "2"; $odds02 = $table3data[5]; $rodds02 = $table3data[9];}}}} if ($event3 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^3$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h03 = $table3data[7];$u03 = $table3data[8]; if ($table3data[4] ne "U"){$status03 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status03 = "SLUT"; $tegn03 = "1"; $odds03 = $table3data[5]; $rodds03 = $table3data[9];}if ($table3data[4] eq "X"){$status03 = "SLUT"; $tegn03 = "X"; $odds03 = $table3data[5]; $rodds03 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status03 = "SLUT"; $tegn03 = "2"; $odds03 = $table3data[5]; $rodds03 = $table3data[9];}}}} if ($event4 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^4$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h04 = $table3data[7];$u04 = $table3data[8]; if ($table3data[4] ne "U"){$status04 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status04 = "SLUT"; $tegn04 = "1"; $odds04 = $table3data[5]; $rodds04 = $table3data[9];}if ($table3data[4] eq "X"){$status04 = "SLUT"; $tegn04 = "X"; $odds04 = $table3data[5]; $rodds04 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status04 = "SLUT"; $tegn04 = "2"; $odds04 = $table3data[5]; $rodds04 = $table3data[9];}}}} if ($event5 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^5$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h05 = $table3data[7];$u05 = $table3data[8]; if ($table3data[4] ne "U"){$status05 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status05 = "SLUT"; $tegn05 = "1"; $odds05 = $table3data[5]; $rodds05 = $table3data[9];}if ($table3data[4] eq "X"){$status05 = "SLUT"; $tegn05 = "X"; $odds05 = $table3data[5]; $rodds05 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status05 = "SLUT"; $tegn05 = "2"; $odds05 = $table3data[5]; $rodds05 = $table3data[9];}}}} if ($event6 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^6$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h06 = $table3data[7];$u06 = $table3data[8]; if ($table3data[4] ne "U"){$status06 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status06 = "SLUT"; $tegn06 = "1"; $odds06 = $table3data[5]; $rodds06 = $table3data[9];}if ($table3data[4] eq "X"){$status06 = "SLUT"; $tegn06 = "X"; $odds06 = $table3data[5]; $rodds06 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status06 = "SLUT"; $tegn06 = "2"; $odds06 = $table3data[5]; $rodds06 = $table3data[9];}}}} if ($event7 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^7$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h07 = $table3data[7];$u07 = $table3data[8]; if ($table3data[4] ne "U"){$status07 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status07 = "SLUT"; $tegn07 = "1"; $odds07 = $table3data[5]; $rodds07 = $table3data[9];}if ($table3data[4] eq "X"){$status07 = "SLUT"; $tegn07 = "X"; $odds07 = $table3data[5]; $rodds07 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status07 = "SLUT"; $tegn07 = "2"; $odds07 = $table3data[5]; $rodds07 = $table3data[9];}}}} if ($event8 =~ /^normal$/i){if (($table3data[0] > 2700) and ($table3data[0] < 2739)){if (($table3data[3] =~ /^8$/i) and ($table3data[7] >= 0) and ($table3data[7] ne "X") and ($table3data[7] ne "")) {$h08 = $table3data[7];$u08 = $table3data[8]; if ($table3data[4] ne "U"){$status08 = "I GANG";} if ($table3data[4] =~ /^1$/i){$status08 = "SLUT"; $tegn08 = "1"; $odds08 = $table3data[5]; $rodds08 = $table3data[9];}if ($table3data[4] eq "X"){$status08 = "SLUT"; $tegn08 = "X"; $odds08 = $table3data[5]; $rodds08 = $table3data[9];}if ($table3data[4] =~ /^2$/i){$status08 = "SLUT"; $tegn08 = "2"; $odds08 = $table3data[5]; $rodds08 = $table3data[9];}}}} }} close(FILE1); -----Oprindelig meddelelse----- Fra: Peter Makholm [mailto:sslug@sslug Sendt: 5. december 2005 14:32 Til: sslug@sslug Emne: Re: [PROGRAMMERING] Adgang til ekstern csv fil "Henning Hansen" <sslug@sslug> writes: > Jeg skal lave et perlscript som skal lave et opslag i en csv fil. Problemet > er at denne fil ligger på en anden server på www. Jeg kan ikke få dette til > at fungere. Brug LWP::Simple Fra manualsiden: NAME LWP::Simple - simple procedural interface to LWP SYNOPSIS perl -MLWP::Simple -e 'getprint "http://www.sn.no"' use LWP::Simple; $content = get("http://www.sn.no/"); die "Couldn't get it!" unless defined $content; if (mirror("http://www.sn.no/", "foo") == RC_NOT_MODIFIED) { ... } if (is_success(getprint("http://www.sn.no/"))) { ... } [...] -- Peter Makholm | Emacs is the only modern general-purpose sslug@sslug | operating system that doesn't multitask http://hacking.dk |
![]() |
![]() |
![]() |
||||||||||||
|
||||||||||||||
![]() | ||||||||||||||
|
||||||||||||||
![]() |
![]() |
![]() |