Re: unfamiliar array reference

2007-08-25 Thread Paul Lalli
On Aug 25, 6:09 am, [EMAIL PROTECTED] (Chas Owens) wrote: > Ah, I knew there was a reason beyond readability that I preferred > fetchrow_hashref: > > from perldoc DBI >"fetchrow_arrayref" >Note that the same array reference is returned for each fetch, >"fetchrow_hashre

Re: unfamiliar array reference

2007-08-25 Thread Chas Owens
On 8/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: snip > No, the version of DBI that I am using is very current so apparently > the DBI book is current on that issue also. Using your code above > (same as book) worked fine. snip Ah, I knew there was a reason beyond readability that I prefe

Re: unfamiliar array reference

2007-08-25 Thread petelink1
On Aug 24, 9:03 am, [EMAIL PROTECTED] (Paul Lalli) wrote: snip > > 'our', like 'my', is lexically scoped. Its effects are terminated > when the innermost enclosing block ends. So if you're using the same > package variable in two different blocks, you have to use 'our' in > each of them: > Yes

Re: unfamiliar array reference

2007-08-24 Thread Paul Lalli
On Aug 24, 9:55 am, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Paul Lalli wrote: > > 'our', like 'my', is lexically scoped. Its effects are terminated > > when the innermost enclosing block ends. So if you're using the same > > package variable in two different blocks, you have to use 'our'

Re: unfamiliar array reference

2007-08-24 Thread Paul Lalli
On Aug 24, 9:37 am, [EMAIL PROTECTED] (Chas Owens) wrote: > On 8/24/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > snip> 'our', like 'my', is lexically scoped. Its effects are terminated > > when the innermost enclosing block ends. So if you're using the same > > package variable in two different bl

Re: unfamiliar array reference

2007-08-24 Thread Chas Owens
On 8/24/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Paul Lalli wrote: > > 'our', like 'my', is lexically scoped. Its effects are terminated > > when the innermost enclosing block ends. So if you're using the same > > package variable in two different blocks, you have to use 'our' in > > e

Re: unfamiliar array reference

2007-08-24 Thread Mr. Shawn H. Corey
Paul Lalli wrote: 'our', like 'my', is lexically scoped. Its effects are terminated when the innermost enclosing block ends. So if you're using the same package variable in two different blocks, you have to use 'our' in each of them: 'our' is not lexically scoped; it is package scoped. Once

Re: unfamiliar array reference

2007-08-24 Thread Chas Owens
On 8/24/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip > 'our', like 'my', is lexically scoped. Its effects are terminated > when the innermost enclosing block ends. So if you're using the same > package variable in two different blocks, you have to use 'our' in > each of them: snip > Your syntax

Re: unfamiliar array reference

2007-08-24 Thread Paul Lalli
On Aug 23, 7:13 pm, [EMAIL PROTECTED] wrote: > On Aug 18, 7:58 pm, [EMAIL PROTECTED] (Paul Lalli) wrote: > I've learned more about references and also about scoping of variables > - now I'm doing "use strict" and it took a while to make it work here. > A side question: why is it necessary to declar

Re: unfamiliar array reference

2007-08-23 Thread petelink1
On Aug 18, 7:58 pm, [EMAIL PROTECTED] (Paul Lalli) wrote: snip > > Is that seriously from the book? UGH. Just declare $array_ref in the > proper scope, and there's no need to take a reference to a dereference > of the reference. > > while (my $array_ref = $sth1->fetchrow_arrayref) { > push

Re: unfamiliar array reference

2007-08-19 Thread Paul Lalli
On Aug 18, 10:03 pm, [EMAIL PROTECTED] (Randal L. Schwartz) wrote: > > "Paul" == Paul Lalli <[EMAIL PROTECTED]> writes: > >> while ($array_ref = $sth1->fetchrow_arrayref) { > >> push @stash, [ @$array_ref ]; ##copy array contents > > Paul> Is that seriously from the book? UGH. Just declare $

Re: unfamiliar array reference

2007-08-18 Thread Randal L. Schwartz
> "Paul" == Paul Lalli <[EMAIL PROTECTED]> writes: >> while ($array_ref = $sth1->fetchrow_arrayref) { >> push @stash, [ @$array_ref ]; ##copy array contents Paul> Is that seriously from the book? UGH. Just declare $array_ref in the Paul> proper scope, and there's no need to take a referenc

Re: unfamiliar array reference

2007-08-18 Thread Paul Lalli
On Aug 17, 5:07 pm, [EMAIL PROTECTED] wrote: > I'm reading the book Programming the Perl DBI to start work with > databases. The DBI portion I'm getting OK, but I find the reference > here to @$ confusing. (This code is based from the book.) > > my $sth1 = $dbh->prepare("select 'SCM_ORDERS_OUT', m

Re: unfamiliar array reference

2007-08-18 Thread Mr. Shawn H. Corey
[EMAIL PROTECTED] wrote: I'm reading the book Programming the Perl DBI to start work with databases. The DBI portion I'm getting OK, but I find the reference here to @$ confusing. (This code is based from the book.) my $sth1 = $dbh->prepare("select 'SCM_ORDERS_OUT', message_index, message_no, m

Re: unfamiliar array reference

2007-08-18 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I'm reading the book Programming the Perl DBI to start work with databases. The DBI portion I'm getting OK, but I find the reference here to @$ confusing. (This code is based from the book.) my $sth1 = $dbh->prepare("select 'SCM_ORDERS_OUT', message_index, message_no, m

Re: unfamiliar array reference

2007-08-18 Thread Chas Owens
On 8/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm reading the book Programming the Perl DBI to start work with > databases. The DBI portion I'm getting OK, but I find the reference > here to @$ confusing. (This code is based from the book.) snip It is funny that you use the word refe

unfamiliar array reference

2007-08-18 Thread petelink1
I'm reading the book Programming the Perl DBI to start work with databases. The DBI portion I'm getting OK, but I find the reference here to @$ confusing. (This code is based from the book.) my $sth1 = $dbh->prepare("select 'SCM_ORDERS_OUT', message_index, message_no, message_event, time_stamp, d