in reply to Creating multiple files and writing in each file
#!/usr/bin/perl use warnings; use strict; my @fh; # will store the filehandles. # Open multiple files. for my $i (1 .. 10) { open $fh[$i], '>', "file-$i" or die $!; } # Write in each. Not sure whether it's simultaneous enough. for my $i (1 .. 10) { print {$fh[$i]} $i; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating multiple files and writing in each file
by AppleFritter (Vicar) on Mar 13, 2015 at 10:51 UTC | |
by irthiza90 (Novice) on Mar 13, 2015 at 12:47 UTC |