Is it "not working" because you're not calling the function, perhaps? It seems to work for me for one set of inputs:
use warnings; #use strict; print min(qw(5 3 9 8)), "\n"; sub min { my (@num); @num = @_; $min = $num[0]; foreach $i (@num) { if ( $i < $min ) { $min = $i; } } return $min; } __END__ 3
In reply to Re: min sub is not working
by toolic
in thread sub min is not working
by bjohn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |