Create an hash of department => IO::File object for that department's log. Read through the main log, determinining what department the entry is for and printing to the corresponding object.
my %handles; for my $dept ( @departments ) { $handles{ $dept } = IO::File->new; $handles{ $dept }->open( "> $logdir/$dept.log" ) or die "Open failed +: $!\n"; } while( <INLOG> ) { my $dept = divine_department( $_ ); $handles{ $dept }->print( $_ ); }
In reply to Re: Break up weblogs
by Fletch
in thread Break up weblogs
by xorl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |