Lhamo_rin has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,
Is there a perl command that will allow me to save several variables to the end of a file rather than overwrite the file?
Llamo_rin

Replies are listed 'Best First'.
(jeffa) Re: Appending Files
by jeffa (Bishop) on Jul 21, 2003 at 16:04 UTC
    Sure, just open the file in append mode:
    open FH, '>>', 'foo.txt' or die "can't append: $!"; print FH, $stuff; close FH;

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: Appending Files
by belg4mit (Prior) on Jul 21, 2003 at 16:01 UTC
    open, The Friendly Manual is your friend.

    --
    I'm not belgian but I play one on TV.

Re: Appending Files
by Mr. Muskrat (Canon) on Jul 21, 2003 at 16:05 UTC
    Read all about open in perlfunc. Pay particular attention when you get to the part about MODEs.