Re: hash of hash - copy

2005-11-04 Thread Frank Bax
At 03:17 PM 11/4/05, Jeff 'japhy' Pinyan wrote: On Nov 4, Frank Bax said: $aSuit{0}{'a'} = 'A'; $aSuit{0}{'b'} = 'B'; $aSuit{0}{'c'} = 'C'; $aSuit{1}{'a'} = 'D'; $aSuit{1}{'b'} = 'E'; $aSuit{1}{'c'} = 'F'; Now I want to make $aSuit{1} a copy of $aSuit{0} %aSuit{1} = %aSuit{0}; Well,

RE: hash of hash - copy

2005-11-04 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Frank Bax wrote: > #!/usr/bin/perl -w > use strict; > > my %aSuit = (); > > $aSuit{0}{'a'} = 'A'; > $aSuit{0}{'b'} = 'B'; > $aSuit{0}{'c'} = 'C'; > $aSuit{1}{'a'} = 'D'; > $aSuit{1}{'b'} = 'E'; > $aSuit{1}{'c'} = 'F'; > > Now I want to make $aSuit{1} a copy of $aSuit{0} > %aSuit{1} = %aSu

Re: hash of hash - copy

2005-11-04 Thread Jeff 'japhy' Pinyan
On Nov 4, Frank Bax said: $aSuit{0}{'a'} = 'A'; $aSuit{0}{'b'} = 'B'; $aSuit{0}{'c'} = 'C'; $aSuit{1}{'a'} = 'D'; $aSuit{1}{'b'} = 'E'; $aSuit{1}{'c'} = 'F'; Now I want to make $aSuit{1} a copy of $aSuit{0} %aSuit{1} = %aSuit{0}; Well, $aSuit{1} = $aSuit{0} would make $aSuit{1} and $a

RE: hash of hash of array slices

2004-01-26 Thread Tim Johnson
I think that only applies to a list slice, i.e. (split /\s+,$_)[3..9], but an array slice doesn't need it, i.e. @array[2] -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 9:38 AM To: [EMAIL PROTECTED] Cc: 'Perl Beginners' Subje

RE: hash of hash of array slices

2004-01-26 Thread Charles K. Clarkson
: -Original Message- : From: Paul Kraus [mailto:[EMAIL PROTECTED] : Sent: Monday, January 26, 2004 10:52 AM : To: 'Charles K. Clarkson'; 'Perl Beginners' : Subject: RE: hash of hash of array slices : : : > Paul Kraus <[EMAIL PROTECTED]> wrote: : > : : &g

RE: hash of hash of array slices

2004-01-26 Thread Paul Kraus
> -Original Message- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED] > Sent: Monday, January 26, 2004 12:10 PM > To: Paul Kraus > Cc: 'Perl Beginners' > Subject: Re: hash of hash of array slices > > On Jan 26, Paul Kraus said: > > &

Re: hash of hash of array slices

2004-01-26 Thread Jeff 'japhy' Pinyan
On Jan 26, Paul Kraus said: >foreach ( @{($hash{$key1}{$key2})[9..1]} ) It should be: foreach ( @{ $hash{$key1}{$key2} }[1 .. 10] ) { ... } based on your other email. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmon

RE: hash of hash of array slices

2004-01-26 Thread Paul Kraus
> Paul Kraus <[EMAIL PROTECTED]> wrote: > : > : This works > : > : Foreach ( @{$hash{$key1}{$key2}} ) > : > : This does note > : > : Foreach ( @{($hash{$key1}{$key2})[9..1]} ) > : > : This gives me this error > : Can't use undefined value as an array reference. > : > > > foreach ( reverse @

RE: hash of hash of array slices

2004-01-26 Thread Charles K. Clarkson
Paul Kraus <[EMAIL PROTECTED]> wrote: : : This works : : Foreach ( @{$hash{$key1}{$key2}} ) : : This does note : : Foreach ( @{($hash{$key1}{$key2})[9..1]} ) : : This gives me this error : Can't use undefined value as an array reference. : foreach ( reverse @{ $hash{$key1}{$key2} }[

RE: Hash of Hash

2003-08-18 Thread Zielfelder, Robert
Beginners List (E-mail) Subject: RE: Hash of Hash I think you mean this... use strict; my %thief_opt; my @name = ("one", "two", "three"); foreach my $layer (@name) { $thief_opt{$layer} = { type => "solid", origin => "datum&q

RE: Hash of Hash

2003-08-18 Thread Hanson, Rob
I think you mean this... use strict; my %thief_opt; my @name = ("one", "two", "three"); foreach my $layer (@name) { $thief_opt{$layer} = { type => "solid", origin => "datum", use_arcs => "yes", }; } # test with this. prints out structure to console. use Data::Dumper; pri

RE: Hash of Hash

2003-08-18 Thread Dan Muey
> Greetings, > > I am attempting to make a hash of hashes or something > equivalent but can't seem to get it working properly. Here > is what I have so far: > > @name = ("one", "two", "three"); > > Foreach my $layer (@name) { > $thief_opt = { > $layer = { >

Re: Hash of hash of array

2002-01-09 Thread Ahmed Moustafa
Jon,thanks a lot for your help :) Jon Molin wrote: > Ahmed Moustafa wrote: > >>Hi All, >> >>My data structure is a hash of a hash of an array. I build it from an >>input file by the following code. Could you help me write it back to an >>output file, please? >> >># Code Begins >>%data = ( ); >>

Re: Hash of hash of array

2002-01-09 Thread Jon Molin
Ahmed Moustafa wrote: > > Hi All, > > My data structure is a hash of a hash of an array. I build it from an > input file by the following code. Could you help me write it back to an > output file, please? > > # Code Begins > %data = ( ); > open (IN, "in.txt") || die; > while () { > chop; >