in reply to efficiently printing to 30 files
Well first, the directory might be getting creating, but you aren't changing to it. You're trying to change to a directory called reports directly under / (root). You should change that to chdir 'reports'; (ie, leave out the leading slash). For the second part, printing to 30 files, how about this:
You might also want to print some kind of separator between the employee info that you print.use IO::File; my %files; $files{A} = $files{B} = $files{C} = IO::File->new('> groupA.txt'); $files{D} = $files{E} = $files{F} = IO::File->new('> groupB.txt'); # etc... for my $n (keys %emp) { print {$files{$n}{Org}} $emp{$n}{Emp}; # ^^^^^^ ^^^^^ # This gets the FH And prints this to it } # Now close the FH's close($file{$key}) for my $key (keys %files);
kelan
Perl6 Grammar Student
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: efficiently printing to 30 files
by thor (Priest) on Mar 07, 2003 at 00:11 UTC |