Created
October 25, 2013 18:08
-
-
Save reneeb/7159200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my @data; | |
my $sth = $dbh->prepare( $sql ) or die $dbh->errstr; | |
$sth->execute; | |
while ( my @row = $sth->fetchrow_array ) { | |
push @data, [@row]; | |
} | |
open my $fh, '>', $flat_file or die $!; | |
print $fh @{$_},"\n" for @data; | |
close $fh; | |
# now better: | |
open my $fh, '>', $flat_file or die $!; | |
my $sth = $dbh->prepare( $sql ) or die $dbh->errstr; | |
$sth->execute; | |
while ( my @row = $sth->fetchrow_array ) { | |
print $fh @row,"\n"; | |
} | |
close $fh; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment