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

I have multiple .txt files for my flatfile database. Each piece of information in the .txt file is on a new line so i can access it by:
@cinfo = <FILEHANDLE>;
Then I get to the indiviual piece of information by using $cinfo[0], $cinfo[1] etc...

Now i need to make $cinfo1 go from 1 to 0 which isn't too difficult BUT i need to do it in ALL the .txt files in that directory. Any Suggestions?

Replies are listed 'Best First'.
Re: multiple files, scalars returning to 0
by jeroenes (Priest) on Dec 30, 2000 at 21:59 UTC
    This isn't too difficult. Just make sure you use loops.
    @files=( $file1,$file2,....); foreach $file (@files){ open( FILE, "<$file"); @info = <FILE>; shift( @info); close FILE; open( FILE, ">$file"); print FILE @info; close FILE; }
    or something similar should do the trick. Or do you mean something else?

    Hope this helps,

    Jeroen
    I was dreaming of guitarnotes that would irritate an executive kind of guy (FZ)