PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: kvk at hmco dot com
Subject: dereference array of arrays from sql() in one statement.
Date: Jun 25 1999 1:12PM

I'm just moving from Perl 4 to 5 and haven't quite figured out all the nuances
of deferencesing stuff yet.  Near as I can tell, the new sql() method returns
a reference to an array that contains a set of references to array thus presenting
a set of rows and columns without all that yucky split stuff from Perl 4.

Suppose I have just one row coming back and want get all the columns.  I've
coded the following which works just fine.  

   $cc = $db->sql($sql);        # do some SQL return one row
   $c = @$cc[0];		# get reference to array representing first row  
   ($col1, $col2, $col) = @$c;  # dereference array reference to get columns.
 
I'm wondering if there's a way to take care of all the deferencing and the array
reference to item [0] in one statement.

   ($col1, $col2, $col) = xyz;

Can anyone provide an expression for xyz that contains $db->sql($sql) and has
the same affect as the three lines above?

-Ken