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?


In reply to Re: how to redirect to other file using system command or anything not by file handler by tospo
in thread how to redirect to other file using system command or anything not by file handler by swapy345

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.