Front page | perl.dbi.users |
Postings from March 2005
adding key to DB object
From:
Brandon Metcalf
Date:
March 29, 2005 09:40
Subject:
adding key to DB object
Message ID:
Pine.LNX.4.58L.0503291113430.24435@cash.rhiamet.com
Can someone explain why I can't do the following:
$ cat uu
#!/usr/bin/perl -l
use strict;
use warnings;
use DBI;
my $dbname = 'foo';
my $host = 'myhost';
my $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$host", '', '');
print $dbh;
$dbh->{commitflag} = 1;
print "commitflag is $dbh->{commitflag}";
__END__
$ ./uu
DBI::db=HASH(0x82f8958)
Use of uninitialized value in concatenation (.) or string at ./uu line 14.
commitflag is
$dbh is nothing but a reference to a hash and I can do the following:
$ cat kk
#!/bin/perl -l
use strict;
use warnings;
my $hr = { 'test' => 1 };
print $hr;
$hr->{flag} = 1;
print $hr->{flag};
__END__
$ ./kk
HASH(0x814cbb8)
1
--
Brandon