--- On Fri, 11/7/08, Lauri Nikkinen <[EMAIL PROTECTED]> wrote:

> From: Lauri Nikkinen <[EMAIL PROTECTED]>
> Subject: Retrieve data via DBI and write into a file
> To: beginners@perl.org
> Date: Friday, November 7, 2008, 8:28 AM

> 
> my $outfile = '>temp.txt';

# ">" is not a part of the regular file name.
my $outfile = "temp.txt";

# get the values of $var1 and $var2 firstly.
# then execute the query below.
$sth->execute($var1, $var2);

# open a file for writting, see perldoc -f open
open OUTFILE, ">", $outfile or die "...";

# read the records line by line,and write them to the file
while(my @re = $sth->fetchrow_array) {
    print OUTFILE @re,"\n";
}

close OUTFILE;


      


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to