[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]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Skrive til en bestemt position i en fil i perl



In article <sslug@sslug>, Jonas Jensen wrote:
>  On Sun, 13 Jun 2004 22:22:01 +0000, Hanne Munkholm wrote:
>  
> > On 2004-06-12, Troels Liebe Bentsen <sslug@sslug> wrote:
> > 
> >>  Det er fordi du åbner filen i "append mode", du skal bare bruge en
> >>  open(FILE, "$XMLFILE");
> > 
> > Filehandle FILE opened only for input at ./printusers.pl line 165. :-(
>  
>  Det skal være:
>  open(FILE, "+<$XMLFILE");

Det prøvede jeg og her er det somom min seek ikke virker. Den
overskriver (trunkerer) filen og kun den sidste entry er tilbage.
>  
>  Du kan gøre det nemmere, og mere memory-venligt:
>  - Åbn filen som jeg skrev oven over. Det vil åbne den for både læsning
>  og skrivning.
>  - Hvis din data altid skal tilføjes på samme sted i forhold til filens
>  slutning, kan du bare seek()'e derhen med WHENCE = SEEK_END og en negativ
>  POSITION. Ellers må du læse dig lidt frem til positionen.
>  - Skriv din data med "print FILE $linje".
>  - Skriv afslutningen på yder-tag'et og luk filen.
>  
>  Den metode ignorerer at det er en xml fil, men jeg vil tro den har 20-50
>  gange så høj performance som hvis du brugte et xml-opmærksomt værktøj.

Det var det jeg gerne ville og ikke kunne få til at virke ;(

-- 
Hanne Munkholm <sslug@sslug>

BOFH excuse of the day: Backbone adjustment



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *