Re: help with array within another array

2007-03-06 Thread Chas Owens
On 3/6/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: "John W. Krahn" schreef: > Dr.Ruud: >> John W. Krahn: >>> Dr.Ruud: Yes, "passing the bareword test" is a better phrase than only mentioning "word" characters. snip > perldoc perlop > -bareword is equivalent to "-bareword" Yes, but un

Re: help with array within another array

2007-03-06 Thread Dr.Ruud
"John W. Krahn" schreef: > Dr.Ruud: >> John W. Krahn: >>> Dr.Ruud: Yes, "passing the bareword test" is a better phrase than only mentioning "word" characters. There are border cases though: perl -Mstrict -MData::Dumper -wle' $_ = { AB => 1, +AB => 2, -AB => 3 }

Re: help with array within another array

2007-03-05 Thread John W. Krahn
Dr.Ruud wrote: > > "John W. Krahn" schreef: >> >> Dr.Ruud wrote: >>> >>> Yes, "passing the bareword test" is a better phrase than only >>> mentioning "word" characters. >>> >>> There are border cases though: >>> >>> perl -Mstrict -MData::Dumper -wle' >>> $_ = { AB => 1, +AB => 2, -AB => 3 }; >

Re: help with array within another array

2007-03-05 Thread Dr.Ruud
"John W. Krahn" schreef: > Dr.Ruud wrote: >> "Chas Owens" schreef: >>> Dr.Ruud: >> Some evaluation is done first: perl -Mstrict -MData::Dumper -wle' $_ = {0b1_0 => "A", 01_0 => "B", 0x1_0 => "C", 1_0 => "D", _1_0 => "E", *_ => "F", \_ => "G"}; print Dumper $_

Re: help with array within another array

2007-03-05 Thread John W. Krahn
Dr.Ruud wrote: > "Chas Owens" schreef: >> Dr.Ruud: > >>> Some evaluation is done first: >>> >>> perl -Mstrict -MData::Dumper -wle' >>> $_ = {0b1_0 => "A", 01_0 => "B", 0x1_0 => "C", 1_0 => "D", _1_0 => >>> "E", *_ => "F", \_ => "G"}; >>> print Dumper $_ >>> ' >>> $VAR1 = { >>> '8' =>

Re: help with array within another array

2007-03-05 Thread Dr.Ruud
"Chas Owens" schreef: > Dr.Ruud: >> Some evaluation is done first: >> >> perl -Mstrict -MData::Dumper -wle' >> $_ = {0b1_0 => "A", 01_0 => "B", 0x1_0 => "C", 1_0 => "D", _1_0 => >> "E", *_ => "F", \_ => "G"}; >> print Dumper $_ >> ' >> $VAR1 = { >> '8' => 'B', >> '_1_0' =>

Re: help with array within another array

2007-03-04 Thread Chas Owens
On 3/4/07, Dr.Ruud <[EMAIL PROTECTED]> wrote: snip Some evaluation is done first: perl -Mstrict -MData::Dumper -wle' $_ = {0b1_0 => "A", 01_0 => "B", 0x1_0 => "C", 1_0 => "D", _1_0 => "E", *_ => "F", \_ => "G"}; print Dumper $_ ' $VAR1 = { '8' => 'B', '_1_0' => 'E',

Re: help with array within another array

2007-03-04 Thread Dr.Ruud
"John W. Krahn" schreef: > Chas Owens: >> In Perl 5 the only difference between the '=>' and ',' operators is >> that the '=>' operator treats the word on the left like a string. >> The '=>' is preferred when working with hashes because it provides a >> visual cue that you are not dealing with a n

Re: help with array within another array

2007-02-27 Thread John W. Krahn
Chas Owens wrote: > On 2/27/07, Neal Clark <[EMAIL PROTECTED]> wrote: > snip >> sorry about saying you had the wrong syntax earlier, i thought it >> was. i never knew you could do hashes with the comma operator. neat. >> i don't think its very clear syntactically but if it works it works :-) > snip

Re: help with array within another array

2007-02-27 Thread John W. Krahn
Neal Clark wrote: > you are working with two different variables. > > On Feb 27, 2007, at 12:24 PM, Ravi Malghan wrote: > >> what am I doing wrong here when trying to access the >> value john for node1 >> = >> $SESSION{FirstRun} = 1; > > this line creates a _hash_, %SESSION with one elem

Re: help with array within another array

2007-02-27 Thread Chas Owens
On 2/27/07, Neal Clark <[EMAIL PROTECTED]> wrote: snip sorry about saying you had the wrong syntax earlier, i thought it was. i never knew you could do hashes with the comma operator. neat. i don't think its very clear syntactically but if it works it works :-) snip In Perl 5 the only differenc

Re: help with array within another array

2007-02-27 Thread Chas Owens
On 2/27/07, Ravi Malghan <[EMAIL PROTECTED]> wrote: what am I doing wrong here when trying to access the value john for node1 = $SESSION{FirstRun} = 1; %nodeowner = ("node1", "john", "node2", "nancy"); push(@SESSION, %nodeowner); print "node1: $SESSION{$nodeowner{node1}}\n"; snip Off t

Re: help with array within another array

2007-02-27 Thread Neal Clark
you are working with two different variables. On Feb 27, 2007, at 12:24 PM, Ravi Malghan wrote: what am I doing wrong here when trying to access the value john for node1 = $SESSION{FirstRun} = 1; this line creates a _hash_, %SESSION with one element (keyed by FirstRun, value is 1).

Re: help with array within another array

2007-02-27 Thread Chas Owens
On 2/27/07, Ravi Malghan <[EMAIL PROTECTED]> wrote: Hi: I just can't seem to figure this out. I am trying to declare two associative array Just call them hashes, everybody else does. (%nodeowner and %nodeseverity) within another array called %SESSION For example %nodeowner = ("node1", "john"

Re: help with array within another array

2007-02-27 Thread Ravi Malghan
what am I doing wrong here when trying to access the value john for node1 = $SESSION{FirstRun} = 1; %nodeowner = ("node1", "john", "node2", "nancy"); push(@SESSION, %nodeowner); print "node1: $SESSION{$nodeowner{node1}}\n"; == Thanks Ravi --- Neal Clark <[EMAIL PROTECTED]> wrote:

Re: help with array within another array

2007-02-27 Thread John W. Krahn
Ravi Malghan wrote: > Hi: I just can't seem to figure this out. > I am trying to declare two associative array > (%nodeowner and %nodeseverity) within another array > called %SESSION > > For example > %nodeowner = ("node1", "john", "node2", "nancy"); > %nodeseverity = ("node1", 5, "node2", 10); >

Re: help with array within another array

2007-02-27 Thread Neal Clark
ah. well in that case @SESSION = ( \%nodeowner, \%nodeseverity ); On Feb 27, 2007, at 11:59 AM, Ravi Malghan wrote: One correction: SESSION is just a single dimensional array @SESSION. Thanks Ravi --- Ravi Malghan <[EMAIL PROTECTED]> wrote: Hi: I just can't seem to figure this out. I am try

Re: help with array within another array

2007-02-27 Thread Neal Clark
well first of all you're using the syntax for non-associative arrays (normal @arrays). your hash declarations should look like this: %nodeowner = (node1 => "john", node2 => "nancy"); %nodeseverity = (node1 => 5, node2 => 10); as for %SESSION, you could make a hash with reference to hash value

Re: help with array within another array

2007-02-27 Thread Ravi Malghan
One correction: SESSION is just a single dimensional array @SESSION. Thanks Ravi --- Ravi Malghan <[EMAIL PROTECTED]> wrote: > Hi: I just can't seem to figure this out. > I am trying to declare two associative array > (%nodeowner and %nodeseverity) within another array > called %SESSION > > For