RE: Printing a hash of hashes of arrays

2009-08-28 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Ian [mailto:pcs...@gmail.com] > Sent: Thursday, August 27, 2009 11:43 > To: beginners@perl.org > Subject: Printing a hash of hashes of arrays > > Pure beginners question. > > I'm creating a hash of arrays like this : > > $ihash{$3}{$1} = [...@itab]; > > For

Re: Printing a hash of hashes of arrays

2009-08-27 Thread Ian
Thank you David, Jim, Uri.

Re: Printing a hash of hashes of arrays

2009-08-27 Thread Uri Guttman
> "I" == Ian writes: I> Pure beginners question. I> I'm creating a hash of arrays like this : I> $ihash{$3}{$1} = [...@itab]; I> For now I was able to get the data using Dumper but I need to create a I> "pretty" report. I> How do I loop over this hash/hash of arrays to print i

Re: Printing a hash of hashes of arrays

2009-08-27 Thread Jim Gibson
On 8/27/09 Thu Aug 27, 2009 10:42 AM, "Ian" scribbled: > Pure beginners question. > > I'm creating a hash of arrays like this : > > $ihash{$3}{$1} = [...@itab]; > > For now I was able to get the data using Dumper but I need to create a > "pretty" report. > > How do I loop over this hash/has

Re: printing a hash

2003-06-12 Thread James Edward Gray II
On Wednesday, June 11, 2003, at 10:33 PM, Stuart White wrote: Well, I got the out put that I wanted. the use Data::Dumper; call really helped with my debugging, thanks for the tip. I understand what's going on except for the printing and the foreach loops, can someone break that down for me?

Re: printing a hash

2003-06-11 Thread Stuart White
Well, I got the out put that I wanted. the use Data::Dumper; call really helped with my debugging, thanks for the tip. I understand what's going on except for the printing and the foreach loops, can someone break that down for me? Also, any other resources on foreach loops? Thanks in advance,

Re: printing a hash

2003-06-11 Thread Rob Dixon
James Edward Gray II wrote: > On Wednesday, June 11, 2003, at 01:21 PM, Rob Dixon wrote: > > > Time to go and play with hashes for a while! Start with > > the simplest imaginable hash > > > > my %hash; > > $hash{A} = 1; > > > > and dump it. Then add additional data, then additional > > lev

Re: printing a hash

2003-06-11 Thread James Edward Gray II
On Wednesday, June 11, 2003, at 01:21 PM, Rob Dixon wrote: Time to go and play with hashes for a while! Start with the simplest imaginable hash my %hash; $hash{A} = 1; and dump it. Then add additional data, then additional levels, and get a feel for what the operations are doing. Just wan

Re: printing a hash

2003-06-11 Thread Rob Dixon
Stuart White wrote: > > > Conceptually, what you have is a tree. There are > > three > > branches from the root, one for each foul type, and > > each of these is split into a further three > > branches, > > one for each player. > > > > Like this: > > -->Rodriguez{numFouls} > -

Re: printing a hash

2003-06-11 Thread Stuart White
> Conceptually, what you have is a tree. There are > three > branches from the root, one for each foul type, and > each of these is split into a further three > branches, > one for each player. > Like this: -->Rodriguez{numFouls} -->offensive-->Chan{numFouls}

Re: printing a hash

2003-06-11 Thread Rob Dixon
Stuart White wrote: > --- Rob Dixon <[EMAIL PROTECTED]> wrote: > > Stuart White wrote: > > > I have a hash called fouls. Within that hash, there > > > are other hashes called offensive, personal, and > > > shooting. The keys to those hashes are names, like > > > Smith, Rodriguez, and Chan. and t

Re: printing a hash

2003-06-11 Thread Stuart White
--- Rob Dixon <[EMAIL PROTECTED]> wrote: > Hi Stuart. > > This project of yours is coming along nicely! > Thanks, I'm getting some help from a tutor and you all on this list, which is helping me move along much faster than I could have done by myself. > Stuart White wrote: > > I have a hash c

Re: printing a hash

2003-06-11 Thread Rob Dixon
Hi Stuart. This project of yours is coming along nicely! Stuart White wrote: > I have a hash called fouls. Within that hash, there > are other hashes called offensive, personal, and > shooting. The keys to those hashes are names, like > Smith, Rodriguez, and Chan. and the values to those > nam

Re: Printing A Hash of Hashes

2002-09-30 Thread Ken Hammer
Mark Anderson wrote: > > Why are you wrapping these in arrays? If you used: > $tablename{$table} -> {con_name} = $constraint_name; > $tablename{$table} -> {con_type} = $type; > $tablename{$table} -> {rem_con_name} = $r_constraint_name; > $tablename{$table} -> {created_by} = $generated;

Re: Printing A Hash of Hashes

2002-09-30 Thread James Edward Gray II
In your adding lines you add entries line [ $entry ], which means, make an array reference (the brackets) which has $entry as the first element of the array. You then have a hash of hashes of arrays (for at least some entries). If you meant the arrays, you'll have to add a third loop to the

RE: Printing A Hash of Hashes

2002-09-30 Thread Mark Anderson
> This is from Chapter 9, page 281 slighly >changed to reflect my values: > >for $table ( keys %tablename) { >print "Table Name: $table \n"; > >for $items ( keys %{ $tablename{$table} } ) { >print "\t$items=$tablename{$table}{$items}\n "; > >} > >print "\n"; That looks re

Re: Printing a hash - weird behavior

2001-06-08 Thread Randal L. Schwartz
> "Mathew" == Mathew Hennessy <[EMAIL PROTECTED]> writes: Mathew> if (/(.*?),/) { Mathew> $key = $1; Mathew> } Mathew> should be safe here, assuming 'in scalar context returns true if it Mathew> succeeds, false if it fails.' means that false is 0 or un

Re: Printing a hash - weird behavior

2001-06-08 Thread Mathew Hennessy
"Randal L. Schwartz" wrote: > > > "jbarry" == jbarry <[EMAIL PROTECTED]> writes: > > jbarry> /(.*?),/; #pattern matching. Grabs everything up to the first comma. > jbarry> (The material number) > jbarry> $key = $1; > > NEVER use $1 unless it's in the context of a conditiona

Re: Printing a hash - weird behavior

2001-06-08 Thread Randal L. Schwartz
> "jbarry" == jbarry <[EMAIL PROTECTED]> writes: jbarry> Thanks for the tip. jbarry> The gist is that it's grabbing the first field in a comma delimited text jbarry> file and making that the key. If the match fails, then something horribly jbarry> wrong has gone on with the input file and th

RE: Printing a hash - weird behavior

2001-06-08 Thread jbarry
"safe", though? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, June 08, 2001 10:47 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Printing a hash - weird behavior >>>>> "jbarry" == jba

Re: Printing a hash - weird behavior

2001-06-08 Thread Chas Owens
On 08 Jun 2001 11:42:34 -0400, Chas Owens wrote: > On 08 Jun 2001 10:31:25 -0500, [EMAIL PROTECTED] wrote: > > The code is below; what's pertinent is really the last line. > > When I drop the ."\n" the hash prints as expected, but with no line breaks > > between records. Assuming concactenating th

Re: Printing a hash - weird behavior

2001-06-08 Thread Randal L. Schwartz
> "jbarry" == jbarry <[EMAIL PROTECTED]> writes: jbarry> /(.*?),/; #pattern matching. Grabs everything up to the first comma. jbarry> (The material number) jbarry> $key = $1; All other comments included, the one thing that hasn't been pointed out is that this is dangerous.

Re: Printing a hash - weird behavior

2001-06-08 Thread Chas Owens
On 08 Jun 2001 10:31:25 -0500, [EMAIL PROTECTED] wrote: > The code is below; what's pertinent is really the last line. > When I drop the ."\n" the hash prints as expected, but with no line breaks > between records. Assuming concactenating the \n would do it, I threw it into > the print command. >