This is a matter of knowing how to use hash references, since this is what's
being returned.  Read perldoc perlref for more info.

Hint...

$hash_ref->{key} (-> dereferences)

Ilya

-----Original Message-----
From: Murali Kanaga
To: '[EMAIL PROTECTED]'
Sent: 1/18/02 6:12 PM
Subject: DBI value assigning Question?


Hi Perl DBI Gurus,

Greetings!

This script is being executed on Solaris. It does connect to an MS SQL
via
DBD::Proxyserver.

        1.      This script prompt the user for a bug-nmber($bfn)

        2.      Checks the SQL db whether the status ($release_status)
is 
                Assigned and for the release ($releasae_ID)
         
        3.      The question is after the while statement: between the
****** lines

any pointers, help would be very much appreciated.

Thanks,
-Murali

Here is the perl script:

# morpheus{root}151: cat trig2.pl
        use strict;
        use DBI;
        use Data::Dumper;
        
#Defined variable
        my $rel_branch = "6.0.0";
        
# DB Source Connection
        ......
        $dbh = DBI->connect( "dbi:Proxy:$proxy;dsn=$dsn", 'reports',
'reports' ) or die "Can't       connect to db: $DBI::errstr\n";
        ...

# User Prompt
        my $bfn = 'Enter the Bug-fix Number');

#SQL Statement

        my $sth = $dbh->prepare( "SELECT p.k_productreview,
q1.s_qualmeasure
as version,     q2.s_qualmeasure as status ...." );
        
        $sth->execute($bfn);

        while( $row = $sth->fetchrow_hashref) {
        print Dumper($row);

************************************************************************
****
*****************
        QUESTION:
        
        1.      How can I assign the the SQL executed output
results(ROWS)
into a variable
                for e.g:

                $release_ID = DONT KNOW HOW TO DO {"version"};

                $release_status = DONT KNOW HOW TO DO {"status"};

        So that I can have the following Logic:

        if (($release_ID =~ /6.0./) && ($release_status =~ /Assigned/)){
************************************************************************
****
*****************

# Here is the ou put of the scriot:

morpheus{root}152:perl -w trig2.pl
$VAR1 = {
          'status' => 'Closed - Fixed',
          'k_productreview' => '2345',
          'version' => '0.0.0'
        };

Reply via email to