in reply to how to redirect to other file using system command or anything not by file handler
You should definitely use code tags
I'm not sure what you mean with "other file" but it looks like your problem might be that the contents of your file gets overwritten. That's because you open the same file with ">" (overwrite) throughout the while loop, or at least you were before commenting out those lines. Do it like this instead:
my $a="/var/lib/processed/parkings-stats2/dailystat_$curtime"; print $a; open (FH, '>', $a) or die "could not open"; while(my $row=$sth->fetchrow_hashref) { my $eunq= $row->{eunq}; my $eclk=$row->{eclk}; my $domain_id=$row->{domain_id}; my $ts = $row->{ts}; my $id = $row->{id}; my $ervn = $row->{ervn}; my $account_id=$row->{account_id}; print "$eunq==$domain_id\n"; print FH "$account_id"; print "$eunq\t$eclk\t$domain_id\t$ts\t$id\t$ervn\t$account_id\n"; } close FH;
Does that solve your problem?
|
|---|