in reply to usage of "my" keyword

Hello ravi45722,

use strict; use warnings; my $number = 8; for my $i (0 .. 19) { print "present value of the number is:", $number++, "\n"; }

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: usage of "my" keyword
by GrandFather (Saint) on Aug 10, 2015 at 09:22 UTC

    But since $i is not used:

    use strict; use warnings; my $number = 8; for (1 .. 20) { print "present value of the number is:", $number++, "\n"; } # or print "present value of the number is:", $number++, "\n" for 1 .. 20;

    make the number of iterations clearer and make it clear that the value of the count is unimportant.

    Premature optimization is the root of all job security
Re^2: usage of "my" keyword
by Tux (Canon) on Aug 10, 2015 at 09:19 UTC

    More merging ...

    use 5.10.0; use warnings; my $number = 8; say "Present value of number is: ", $number++ for 0 .. 19;

    Enjoy, Have FUN! H.Merijn