
jazzo
Novice
Aug 25, 2012, 10:41 AM
Post #1 of 4
(1418 views)
|
variable declaration and countdown
|
Can't Post
|
|
Hi peeps, I came across this simple script:
#!/usr/bin/perl # countdown.plx use warnings; use strict; my @count = (1..5); for (reverse(@count)) { print "$_...\n"; sleep 1; } print "BLAST OFF!\n"; and I was wondering, shouldn't the variable be declare as rather than using it without declaring it? The the other thing. to print off the numbers we say: why do we use "$_"? can we not use the array something like
print "$count[reverse]\n"; thanks
(This post was edited by jazzo on Aug 25, 2012, 10:48 AM)
|