Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: concatenate directories and files into one csv

by almut (Canon)
on Apr 28, 2009 at 16:42 UTC ( [id://760661]=note: print w/replies, xml ) Need Help??


in reply to concatenate directories and files into one csv

...but it only gives me the last file's content.

foreach my $file (@files) { ... open FILE, ">$dir/$file"; ... }

Open the output file once outside of the loop, or open it in append mode (">>"), if you want to accumulate content...

Update: Actually, it seems that FILE2 is supposed to be the output file for the accumulated content... (thanks jethro!)  The comment with respect to opening it once or in append mode still applies, though.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://760661]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-24 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found