concating files together
Andrew Wilson
andrew at rivendale.net
Fri May 23 10:36:32 CDT 2003
On Fri, May 23, 2003 at 04:32:06PM +0100, Andrew Wilson wrote:
> my $maillog = '/tmp/maillog';
>
> {
> open LOG, $maillog or die "Can't open $maillog $!";
> local @ARGV = qw{file1 file2 file3};
> while (<>) {
> print OUT $_;
> }
> }
>
> The only remaining problem is that the list of files you're going to
> concat is fixed. You can get a list that changes like the /log/maillog*
> in your original example using the glob function.
>
> my $maillog = '/tmp/maillog';
>
> {
> open LOG, $maillog or die "Can't open $maillog $!";
> local @ARGV = glob('/log/maillog*');
> while (<>) {
> print OUT $_;
> }
> }
GAh! never ever send untested code to a mailig list. The file handle
I'm calling OUT above should be LOG
my $maillog = '/tmp/maillog';
{
open LOG, $maillog or die "Can't open $maillog $!";
local @ARGV = glob('/log/maillog*');
while (<>) {
print LOG $_;
}
}
andrew
--
"Customers who wear clothes also shop for:"
Amazon thought this was worth bringing to my attention in their recommendations,
and the first item in the recommendations? clean underwear
More information about the Belfast-pm
mailing list