I reread the docs and I am still unclear with the
code:
$a[ 10 + rand( @a - 10 )
I do understand everything but $a[ 10 + rand( @a - 10
)

b/c you say subtract 10 from each element occurrance
=> @a - 10 then add 10 to the result of rand (@a - 10)
To me this is offsets itself which is why I am
confused. Will you explain again?
I think you missed an explanation step between a and
b?

Reagardless it work so thank you.


--- "D. Bolliger" <[EMAIL PROTECTED]> wrote:

> Derek B. Smith am Donnerstag, 28. September 2006
> 22:28:
> > > Why not just specify a non-digit for the first
> > > character:
> > >
> > > my @a = ( 0 .. 9, 'a' .. 'z', 'A' .. 'Z');
> > >
> > > my $password = join '', $a[ 10 + rand( @a - 10 )
> ],
> > > map $a[ rand @a ], 1 .. 5;
> > >
> > >
> > >
> > > John
> >
> > Ok great, but I do not fully understand this. Will
> you
> > explain in English?
> 
> Join with '':
> a) a randomly selected entry from @a excluding the
> digits
>    at positions 0..9 [the part between the 1st and 
>    2nd comma]
> b) five randomly selected entries from @a
>    [the map part]
> 
> Note: @a is used in scalar context both times,
> meaning the number of entries 
> in @a.
> 
> perldoc -f map
> perldoc -f join
> perldoc -f rand
> 
> 
> My tip for cases where you get a working solution
> you don't understand fully:
> a) Try to find out what "belongs together" (imagine
> '()'s)
> b) Try to break the solution apart according to the
> findings in a)
> c) examine the parts: print them out, dump them with
> Data::Dumper, modify
>    them, read the man pages
> d) put them together again, eventually one by one
> part, using examination 
>    techniques as in c)
> 
> 
> Hope this helps!
> 
> Dani
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to