|
发表于 2004-2-10 20:50:42
|
显示全部楼层
我的第一题:
- #! /usr/bin/perl -w
- for($i = 1; $i <= 100; $i++){
- if($i % 2){
- push(@odd, $i);
- }else{
- push(@even, $i);
- }
- if($i =~ /[1,2,7]$/){
- push(@end, $i);
- }
- }
- print join(", ", @even), "\n\n";
- print join(", ", @odd), "\n\n";
- print join(", ", @end), "\n";
复制代码 |
|