in reply to usage of "my" keyword
You have use strict; so you must declare variables or the error you see will be thrown. If you've copied/paste this without understanding I suggest you read and understand strict. An alternative would be to declare $i within the for loop.
"How to merge these three lines"
One way to write this:
use strict; use warnings; my $number=8; for( my $i=0; $i<20; $i++ ){ print "present value of the number is: $number\n"; $number++; }
If you are new to perl the following links will likely be of interest:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: usage of "my" keyword
by ravi45722 (Pilgrim) on Aug 10, 2015 at 09:28 UTC | |
by Laurent_R (Canon) on Aug 10, 2015 at 10:07 UTC | |
by AnomalousMonk (Archbishop) on Aug 10, 2015 at 12:31 UTC | |
by ikegami (Patriarch) on Aug 10, 2015 at 14:47 UTC |