l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 17:04

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] A question of perl style
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] A question of perl style

  • Subject: [vox-tech] A question of perl style
  • From: Jay Strauss <jjstrauss@yahoMAPSo.com>
  • Date: Mon, 30 Apr 2001 11:01:38 -0700

Lets say I have a database handle object, $dbh.  Now I
want to pass it to another subroutine like:


sub backup
   my (%arg) = @_;
   my $sth = $arg{"dbh"}->prepare(some SQL);
   my $rc  = $sth->execute();

Now this works, but shouldn't I be passing a reference
to the object, and then unreferencing it in the sub

I tried:

backup (dbh=>\$dbh);

sub backup
   my (%arg) = @_;
   my $dbh = \$arg{"dbh"};
   my $sth = $dbh->prepare(some SQL);
   my $rc  = $sth->execute();

But that didn't work.  Maybe this is all stupid
because I think $dbh is just a pointer to an object,
and so passing by value just gives me another pointer
to an object.


Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.