Interesting Perl Typo

davorg on 2005-11-30T11:52:31

Took me a while to work out what this interesting Perl typo was doing.

$ perl -le 'print rand[10]'
24306146.4335798
$ perl -le 'print rand[10]'
49138251.923694

Obviously what was intended was rand(10).

Can you work out what's going on before reading the discussion on Perlmonks?


Re:

Aristotle on 2005-11-30T21:35:04

It took me about 5 seconds. :-)