SkÃ¥ne Sjælland Linux User Group - http://www.sslug.dk Forside   Tilmelding   Postarkiv   Forum   Kalender   Søg
MhonArc Dato: [Date Prev] [Kronologisk oversigt] [Date Next]   TrÃ¥d: [Date Prev] [Oversigt trÃ¥de] [Date Next]   MhonArc
 

Re: [PERL] Simpelt Perl spørgsmål



> #!/usr/bin/perl
> #
> $filnavn = "xml$$";
> open(FILE, ">>/tmp/$filnavn") or die "Can't write to $filnavn; $!\n";
> while ($line = <STDIN>) {
>   last if $line = "";
> }
> print FILE <STDIN>;
> close (FILE);

Noget i denne stil ville nok være bedre:
#!/usr/bin/perl -w
$filnavn ="xml$$";
open(FILE, ">>/tmp/$filnavn") or die "Can´t...\n";
while(<STDIN>){
        $content .= $_;
}
print FILE $content;
close FILE;



-- 
./Jesper Krogh.
The Goal is world domination, no more, no less.
This means that your PC should run linux too.



 
Forside   Tilmelding   Postarkiv   Oversigt   Kalender   Søg

 
 
Henvendelse vedrørende websiderne til <www_admin>. Senest ændret 2005-08-10, klokken 19:53
Denne side vedligeholdes af MHonArc .