[Pdx-pm] accessing list elements

Colin Kuskie ckuskie at dalsemi.com
Wed Sep 3 18:00:21 CDT 2003


On Wed, Sep 03, 2003 at 03:45:47PM -0700, Michael Rasmussen wrote:
> When reading through some code I came across this:
> 
> my $pic = $files[rand @files];
> 
> huh?  rand returns a "random fractional number". And lists are
> accessed through integers.  
> 
> Or not?
> 
> A simple test case shows that you can access list members with
> fractional numbers.  This is handy, but puzzling behavior.
> I couldn't find a reference to this in the docs.

Does it round or truncate?

Colin



More information about the Pdx-pm-list mailing list