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: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Syb perl question
Date: Jan 16 2002 9:03PM

Sabherwal, Balvinder (MBS) writes:
 > I have a code as 
 > 
 > foreach my $row (@$sysdb) {
 > 	my @cols = keys(%$row);
 > 	foreach my $kv (@cols) {
 > 		print "$kv";
 > 		if($kv eq "RSSD Dataserver"){
 > 			$rsds="$row->{$_}";
 > 			print "$row->{$_}";
 > 		}
 > 		else
 > 		{
 > 			$rsdb="$row->{$_}";
 > 			print "$row->{$_}";
 > 		}
 > 		
 > 	}
 > }
 > 
 > after execution I am not getting the data values for the columns i.e. print
 > "$row->{$_}"; returns blank. Am I missing something??

Yeah :-)

Use $row->{$kv} - $_ never gets set in your loop.

Michael
-- 
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
mpeppler@peppler.org - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com