Re: Creating a hash of arrays from row data

2003-07-11 Thread Sudarshan Raghavan
Robin Norwood wrote: To sort-of change the subject, I think the 'deep_copy' subroutine quoted in this article contains a bug... the sub in question: sub deep_copy { my $this = shift; if (not ref $this) { $this; } elsif (ref $this eq "ARRAY") { [map deep_copy($_), @$this]; } elsif (ref $t

Re: Creating a hash of arrays from row data

2003-07-10 Thread Robin Norwood
Sudarshan Raghavan <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] creates an anonymous arrayref by copying the values stored > in @values. perldoc perlref, perldoc perllol > > If you are going use this statement > push @{$ref_to_a}, [EMAIL PROTECTED]; > your while condition must be while (my @v

Re: Re: Creating a hash of arrays from row data

2003-07-10 Thread Jeroen Lodewijks
OTECTED] Date: Thu, 10 Jul 2003 12:26:25 +0100 Subject: Re: Creating a hash of arrays from row data Sudarshan Raghavan wrote: > Rob Dixon wrote: > > > I was perturbed by your post Sardushan. I'll > > try to explain why. > > > > Wait a second, my post was not a

Re: Creating a hash of arrays from row data

2003-07-10 Thread Rob Dixon
Sudarshan Raghavan wrote: > Rob Dixon wrote: > > > I was perturbed by your post Sardushan. I'll > > try to explain why. > > > > Wait a second, my post was not an attempt to undermine Rob > Anderson's post in any manner. I apologize if the wrong message > came out. And I'll also apologize since, al

Re: Creating a hash of arrays from row data

2003-07-10 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Sudarshan Raghavan wrote: > Kevin Pfeiffer wrote: > >>In article <[EMAIL PROTECTED]>, Sudarshan Raghavan >>wrote: >>[...] >> >> >>>Reason: 'shallow copying' vs 'deep copying' >>>Read through this link >>>http://www.stonehenge.com/merlyn/UnixReview/col30.html >>>

Re: Creating a hash of arrays from row data

2003-07-10 Thread Rob Anderson
"Sudarshan Raghavan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Rob Dixon wrote: > > >I was perturbed by your post Sardushan. I'll > >try to explain why. > > > > Wait a second, my post was not an attempt to undermine Rob Anderson's > post in any manner. I apologize if the wrong

Re: Creating a hash of arrays from row data

2003-07-09 Thread Sudarshan Raghavan
Kevin Pfeiffer wrote: In article <[EMAIL PROTECTED]>, Sudarshan Raghavan wrote: [...] Reason: 'shallow copying' vs 'deep copying' Read through this link http://www.stonehenge.com/merlyn/UnixReview/col30.html I looked at this article and tried the code but I get different/wrong results (

Re: Creating a hash of arrays from row data

2003-07-09 Thread Sudarshan Raghavan
Rob Dixon wrote: I was perturbed by your post Sardushan. I'll try to explain why. Wait a second, my post was not an attempt to undermine Rob Anderson's post in any manner. I apologize if the wrong message came out. I sincerely hope that this does not turn Rob away from this list. Giving an answ

Re: Creating a hash of arrays from row data

2003-07-09 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Sudarshan Raghavan wrote: [...] > Reason: 'shallow copying' vs 'deep copying' > Read through this link > http://www.stonehenge.com/merlyn/UnixReview/col30.html I looked at this article and tried the code but I get different/wrong results (or am doing something wr

Re: Creating a hash of arrays from row data

2003-07-09 Thread Rob Dixon
Paul Johnson wrote: > On Wed, Jul 09, 2003 at 11:24:01PM +0100, Rob Dixon wrote: > > > Sudarshan Raghavan wrote: > > > > > Reason: 'shallow copying' vs 'deep copying' > > > Read through this link > > > http://www.stonehenge.com/merlyn/UnixReview/col30.html > > > > How many computer scientists do yo

Re: Creating a hash of arrays from row data

2003-07-09 Thread Paul Johnson
On Wed, Jul 09, 2003 at 11:24:01PM +0100, Rob Dixon wrote: > Sudarshan Raghavan wrote: > > > Reason: 'shallow copying' vs 'deep copying' > > Read through this link > > http://www.stonehenge.com/merlyn/UnixReview/col30.html > > How many computer scientists do you think would know what you > were

Re: Creating a hash of arrays from row data

2003-07-09 Thread Rob Dixon
I was perturbed by your post Sardushan. I'll try to explain why. Sudarshan Raghavan wrote: > Rob Anderson wrote: > > > Hi Jeroen, > > > > > > > > > while (@values = $lcsr->fetchrow) { > > > > > > > > > > This is probably the root of your problem every time you go > > through this loop, you are rep

Re: Creating a hash of arrays from row data

2003-07-09 Thread Rob Anderson
"Sudarshan Raghavan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Rob Anderson wrote: > > >Hi Jeroen, > > > > > > > >>while (@values = $lcsr->fetchrow) { > >> > >> > > > >This is probably the root of your problem every time you go through this > >loop, you are repopulating your ar

Re: Creating a hash of arrays from row data

2003-07-09 Thread Sudarshan Raghavan
Rob Anderson wrote: Hi Jeroen, while (@values = $lcsr->fetchrow) { This is probably the root of your problem every time you go through this loop, you are repopulating your array, put a my before @values. Why do you think this is a problem? All the my would do is create a new lexical @val

Re: Creating a hash of arrays from row data

2003-07-09 Thread Rob Anderson
Hi Jeroen, >while (@values = $lcsr->fetchrow) { This is probably the root of your problem every time you go through this loop, you are repopulating your array, put a my before @values. >$key = shift @values; >$key.= shift @values; > >push @$ref_to_a, [EMAIL PROTECTED]; I don't recog

Creating a hash of arrays from row data

2003-07-09 Thread Jeroen Lodewijks
Hi all, I could use some help with the following problem: I have rows of data (coming in from DBI) looking like this: Key1, Key2, Date_from, Date_to, Value 1, 1, 01-10-2002, 31-10-2002, value1 1, 1, 01-11-2002, 30-11-2002, value2 1, 2, 01-10-2002, 31-10-2002, value3 1, 2, 01-10-2002, 30-10-2002