Advertisement

01.07.2008 at 04:21AM PST, ID: 23063235 | Points: 50
[x]
Attachment Details

Complete newbie "format" issue?

Asked by j2 in Perl Programming Language

Tags:

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:insidan','dbuser','password')
or die "Connection Error: $DBI::errstr\n";

$sql = "select jos_users.name as Namn,jos_events_registrations.name As Nick from jos_events_registrations,jos_users where jos_events_registrations.userid = 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
[+][-]01.07.2008 at 06:22AM PST, ID: 20599543

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.07.2008 at 07:53AM PST, ID: 20600337

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628