Re: joining keys

2003-07-11 Thread Rob Dixon
Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, Rob Dixon > wrote: > > > Well done Kevin! > > > > Just a couple of points. > > Am I surprised? ;-) > > > > sub pad_keys { > > >my $ref = shift; > > >if (ref $ref eq "HASH") { > > > for my $value (%$ref) { > > > > This will loop o

Re: joining keys

2003-07-11 Thread Rob Dixon
Rob Dixon wrote: > John W. Krahn wrote: > > Rob Dixon wrote: > > > > > > Well done Kevin! > > > > > > Just a couple of points. > > > > > > Kevin Pfeiffer wrote: > > > > > > > > (I noticed that, too.) But thanks to your tip I think I've > > > > created my first recursive sub-routine (only tested on

Re: joining keys

2003-07-11 Thread Rob Dixon
John W. Krahn wrote: > Rob Dixon wrote: > > > > Well done Kevin! > > > > Just a couple of points. > > > > Kevin Pfeiffer wrote: > > > > > > (I noticed that, too.) But thanks to your tip I think I've > > > created my first recursive sub-routine (only tested on this > > > example). If it does what th

Re: joining keys

2003-07-11 Thread Steve Grazzini
On Fri, Jul 11, 2003 at 02:17:52PM -0700, John W. Krahn wrote: > Rob Dixon wrote: > > sub pad_keys { > > foreach (keys %$ref) { > > pad_keys($ref->{$_}); > > next unless (my $new = $_) =~ tr/ /_/; > > if (exists $ref->{$new}) { > > warn "Padded key $new already exist

Re: joining keys

2003-07-11 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: [...] > Kevin and Rob, > > perldoc -q "add or remove keys from a hash" > > Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod >What happens if I add or remove keys from a hash while >iterating over it? > >Don't do that. :

Re: joining keys

2003-07-11 Thread John W. Krahn
Rob Dixon wrote: > > Well done Kevin! > > Just a couple of points. > > Kevin Pfeiffer wrote: > > > > (I noticed that, too.) But thanks to your tip I think I've created > > my first recursive sub-routine (only tested on this example). If it > > does what the OP requested (and y'all don't find too

Re: joining keys

2003-07-11 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > Well done Kevin! > > Just a couple of points. Am I surprised? ;-) >> sub pad_keys { >>my $ref = shift; >>if (ref $ref eq "HASH") { >> for my $value (%$ref) { > > This will loop over all the keys and values in the > hash, in the o

RE: joining keys

2003-07-11 Thread Gupta, Sharad
y, July 11, 2003 10:28 AM To: [EMAIL PROTECTED] Subject: Re: joining keys Well done Kevin! Just a couple of points. Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > > > Sharad Gupta wrote: > > > > > > Hi Friends, > > > >

Re: joining keys

2003-07-11 Thread Rob Dixon
Well done Kevin! Just a couple of points. Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > > > Sharad Gupta wrote: > > > > > > Hi Friends, > > > > Hello, > > Hi, > > > > I have a hash whose values can be either array, hash etc. > > > > > > say i have: > > > > > > my

Re: joining keys

2003-07-11 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > Sharad Gupta wrote: >> >> Hi Friends, > > Hello, Hi, >> I have a hash whose values can be either array, hash etc. >> >> say i have: >> >> my $self = { >> 'hello how' => { >> 'r u' => 'I am', >> >> >

Re: joining keys

2003-07-10 Thread John W. Krahn
Sharad Gupta wrote: > > Hi Friends, Hello, > I have a hash whose values can be either array, hash etc. > > say i have: > > my $self = { > 'hello how' => { > 'r u' => 'I am', > > > }, > 'fine thank' => ['you'], > 'see ya'=> 'next ti

joining keys

2003-07-10 Thread Gupta, Sharad
Hi Friends, I have a hash whose values can be either array, hash etc. say i have: my $self = { 'hello how' => { 'r u' => 'I am',