#!/usr/bin/perl use strict; use warnings; use DBI; my $dsn = 'DBI:Sybase:host=myhost;port=1433;database=mydb'; my $dbh = DBI->connect($dsn, "user", 'pass'); die "unable to connect to server $DBI::errstr" unless $dbh; $dbh->do("use mydb") or die "couldn't change database"; my $query = "SELECT * FROM Session"; my $sth = $dbh->prepare ($query) or die "prepare failed\n"; $sth->execute( ) or die "unable to execute query $query error $DBI::errstr"; my $rows = $sth->rows ; while ( @first = $sth->fetchrow_array ) { foreach $field (@first) { print "field: $field\n"; } }