Ph" == Perusion hostmaster said:
my $tmp1 = $rand[rand @rand];
that is the classic select a random element from an array idiom.
Ph> With luck I will remember that next time and flag it as
Ph> authoritative.
Ph> I do know that. I am not a big fan of autovivification, and almost
Ph> always explicitly instantiate anonymous refs. In fact, I would
Ph> like to see:
Ph> use strict qw/no_autovivify/;
autoviv is good for you in general. if you had to manually do it each
time, it would be a major pain to dynamically generate deep
structures. you couldn't just push into a hash slot, you would have to
check and then initialize it each time:
push( @{$self->{'foo'}}, $stuff ) ;
push( @{$self->{'foo'} ||= [] }, $stuff ) ;
and that gets worse with each level.
Ph> for(my $i = 0; $i < @ARGV; $i++) { $hash{$tmp1}{$ARGV[$i]} = $i;
Ph> Done that way to try and talk to the less-experienced on their
Ph> level.
and you can even talk lower level that your code. you have to write code
to some level of skill and not below that. i prefer to use hash slices
as they are not complex, obscure and are teachable. look at my paper on
them at
http://www.sysarch.com/perl/tutorials/hash-slices.txt
Ph> If you insist on the tired Perl 4 way:
Ph> You are probably right.
s/probably// ;
uri