Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Defining Arrays

by alfie (Pilgrim)
on May 17, 2001 at 16:07 UTC ( #81209=note: print w/replies, xml ) Need Help??

in reply to Defining Arrays

The .. operator steps by one, you can't change that behavior. But you can do it with a for loop:
my @results; for (my $i=0; $i <= 79; $i++) { push @results, ($i/10+1.5); }
It seems a bit awkward but it give's you the right result. Please notice that I didn't loop from 1.5 to 9.4 with a stepping of .1 for that would get imprecise (I got with a quick perl -e test 5.99999999999999 instead of 6). You can't go precisely if you are calculating with floats.
use signature; signature(" So long\nAlfie");

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-01-18 04:39 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (52 votes). Check out past polls.