Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Use Hash? Array? Still confused after all these years.

by benizi (Hermit)
on Jul 22, 2005 at 14:29 UTC ( [id://477234]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Use Hash? Array? Still confused after all these years.
in thread Use Hash? Array? Still confused after all these years.

I hate to nitpick, because I agree that "non negative numbers" is certainly technically imprecise, and "non negative integers" is overly verbose (an entire extra word! *gasp*), compared to "whole numbers". (Incidentally, "counting numbers" doesn't include zero.) But, check this out:

perl -Mstrict -lwe 'my @a = (0..20); print $a[$_] for 3.14159, 0.06, ( +75/9), (-75/9)' 3 0 8 13

Perl seems to be doing an implicit 'int' on the index. (Anyone with better understanding of internals know where this happens? I tried creating a simple Tied class, and the FETCH func still sees a whole number.) This allows you to write $array[rand @array] rather than $array[int rand @array], for example.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://477234]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 22:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found