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:27PM

Scott Zetlan writes:
 > Also, depending on your Perl version (perl -v), the line:
 > print "$row->{$kv}\n";
 > will not do what you expect.  You'll see something like:
 > HASH=0xafde9f->{keyname}

Ouch. I don't remember seeing that - which version of perl does that?

Michael


 > > -----Original Message-----
 > > From: owner-SYBPERL-L@list.cren.net
 > > [mailto:owner-SYBPERL-L@list.cren.net]On Behalf Of Michael Peppler
 > > Sent: Wednesday, January 16, 2002 4:04 PM
 > > To: SybPerl Discussion List
 > > Subject: Re: Syb perl question
 > >
 > >
 > > 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
 > >
 > >
 > 

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