Okay, i am a complete newbie with perl, and i need (well, want) to do some formatting
If we look at my code snippet, i want to make this print in a nice table and if possible with a header above each column, but i am unable to figure out how to assign a format to output?
#!/usr/bin/perl -w
use DBI;
$dbh = DBI->connect('dbi:mysql:in
sidan','db
user','pas
sword')
or die "Connection Error: $DBI::errstr\n";
$sql = "select jos_users.name as Namn,jos_events_registrati
ons.name As Nick from jos_events_registrations,j
os_users where jos_events_registrations.u
serid = jos_users.id order by jos_users.name;";
$sth = $dbh->prepare($sql);
$sth->execute
or die "SQL Error: $DBI::errstr\n";
while (@row = $sth->fetchrow_array) {
print "$row[0] \t\t $row[1]\n";
}
Start Free Trial