#!/usr/bin/perl use DBI; use DBD::mysql; print "Connecting...\n"; my $platform; my $database; my $host; my $port; my $tablename = "points"; my $user; my $pwd; open(STDOUT, ">C:\\perlscripts\\pts.txt") || die "Can't open the file"; my $dsn = "dbi:mysql:$database:$host:$port"; my $dbh = DBI->connect($dsn,$user,$pwd) || die "Could not connect: $DBI::errstr\n"; my $query = $dbh->selectall_arrayref("select dat, code, id, cur, hrs, tips from points order by id, dat", { Slice => {} }); foreach my $row(@$query) { print "$row->{dat}\t$row->{code}\t$row->{id}\t$row->{cur}\t$row->{hrs}\t$row->{tips}\n"; }