I have a list of file names. I need to create a file for each of these names, write the lines to different files (in a specific order), and then close them.
How can I do this in perl? I foresee something like the following code (which will not work on this form and give syntax errors):
my @names = qw(foo.txt bar.txt baz.txt); my @handles; foreach(@names){ my $handle; open($handle, $_); push @handles, $handle; }
How can I do it right?
source share