Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: for loop less than test ill behaved...

by jwkrahn (Abbot)
on Mar 30, 2020 at 19:43 UTC ( [id://11114813]=note: print w/replies, xml ) Need Help??


in reply to for loop less than test ill behaved...

Or you could use a different type of for loop:

$ perl -le' my $my_rand5 = rand( 5 ); my $data_length = 5 + $my_rand5; printf "data length = %d\n", $data_length; for my $k ( 0 .. $data_length - 1 ) { printf "loop k = %d\n", $k; } ' data length = 9 loop k = 0 loop k = 1 loop k = 2 loop k = 3 loop k = 4 loop k = 5 loop k = 6 loop k = 7 loop k = 8

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found