> -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 :
Thank you David, Jim, Uri.
> "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
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
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/hash of arrays to print it out?
Thank you.
--
Ian
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?
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,
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
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
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}
> -
> 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}
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
--- 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
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
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
names are numbers.
I think if I wanted to access the number of offensive
fouls Chan committe
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;
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
> 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
From a previous post I needed to identify
a particular data structure. It is a hash of hashes.
Now, I need to print the hash out.
I'm using the code from the "Programing
Perl" 3rd edition from O'Reilly on how
to print out the hash and of course I'm
having a problem.
This is from Chapter 9, p
> "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
"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
> "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
"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
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
> "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.
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.
>
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.
Now it returns a value of 2/8 instead of the hash values. . . what
27 matches
Mail list logo