my program inputs values from a text file and stores them in an array called @nums. Is there an alternative code that can accomplish the same task? Thank you in advance, Ostra.
#!/perl/ -w @nums=(); #array of numbers $count=0; #count of numbers while(<>){ chomp($input=$_); if($input ne ''){ $nums[$count++]=$input; } else{last;} } @nums= sort {$a<=>$b} @nums; print "\nminimum number: $nums[0]"; print "\nmaximum number: $nums[$#count]";
In reply to storage of numbers by ostra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |