self referential arrays/hashes ?

2011-08-18 Thread Zak
can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? Zak -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: self referential arrays/hashes ?

2011-08-18 Thread Dr.Ruud
On 2011-08-18 16:51, Zak wrote: can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? See Data::Alias and Array::RefElem. perl -Mstrict -MData::Dumper -MData::Alias -wle ' my @data = qw(A B C D A E F A B B A);

Re: self referential arrays/hashes ?

2011-08-18 Thread Rob Dixon
On 18/08/2011 15:51, Zak wrote: can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? You can write my @array; @array=('A', 'B', 'C', 'D', \$array[0], 'E', 'F'); What are you trying to do? Rob -- To unsub

Re: self referential arrays/hashes ?

2011-08-18 Thread Jim Gibson
On 8/18/11 Thu Aug 18, 2011 7:51 AM, "Zak" scribbled: > can you reference elements of an array/hash from within that array/ > hash for example would > > @array=(A, B, C, D, $array[0], E, F) > > fly? Try it out. See what you get. The above will not set the fifth element of @array to 'A', how

Re: self referential arrays/hashes ?

2011-08-18 Thread Shawn H Corey
On 11-08-18 10:51 AM, Zak wrote: @array=(A, B, C, D, $array[0], E, F) This is the same as: { my @temporary = @array; @array = ( A, B, C, D, $temporary[0], E, F ); } -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of understanding. Programming is as much

self referential arrays/hashes ? [sort]

2011-08-18 Thread shawn wilson
". $i . ":" . $sorted->[ $i ]->[ $j ]->[ 1 ] . " had " . $sorted->[ $i ]->[ $j ]->[ 0 ] . " duplicates\n" if( $sorted->[ $i ]->[ $j ] ); } } -- Forwarded message -- From: Rob Dixon Date: Thu, Aug 18, 2011 at 17:37 Subje

Re: self referential arrays/hashes ?

2011-08-18 Thread Dr.Ruud
On 2011-08-18 21:58, Dr.Ruud wrote: On 2011-08-18 16:51, Zak wrote: can you reference elements of an array/hash from within that array/ hash for example would @array=(A, B, C, D, $array[0], E, F) fly? See Data::Alias and Array::RefElem. perl -Mstrict -MData::Dumper -MData::Alias -wle '