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,
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
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
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
: -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
> -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:
>
> &
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
> 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 @
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} }[
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
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
> 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 = {
>
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 = ( );
>>
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;
>
14 matches
Mail list logo