perl for
时间:2010-11-06 来源:hjjie2006
[root@localhost 001]# cat for.plx
#!/usr/bin/perl -w print "The Begin!\n"; for ( $a=0; $a<10; $a++ ) { print "a is now $a \n";
}
$i=10; for ( ; $i>-1; ) { print "$i..\n";
$i--;
} print "The End!\n" Output [root@localhost 001]# perl for.plx
The Begin!
0--1--2--3--4--5--6--7--8--9--10--
10..9..8..7..6..5..4..3..2..1..0..
The End!
#!/usr/bin/perl -w print "The Begin!\n"; for ( $a=0; $a<10; $a++ ) { print "a is now $a \n";
}
$i=10; for ( ; $i>-1; ) { print "$i..\n";
$i--;
} print "The End!\n" Output [root@localhost 001]# perl for.plx
The Begin!
0--1--2--3--4--5--6--7--8--9--10--
10..9..8..7..6..5..4..3..2..1..0..
The End!
相关阅读 更多 +
排行榜 更多 +