Jonathon wrote: > How do I get the maximum and minimum values of an > array?
Interesting question. I've never tried that one before. > All the obvious answers were given (including sort), > but I wanted something a little most hackish. Not sure if this does what you want, but it works and I think it may be somewhat "hackish": __BEGIN__ my @a = qw(23 3 523 2 5); ($x="@a") =~ s/(\d+) ?/$max=$1>$max?$1:$max/eg; ($x="@a") =~ s/(\d+) ?/$min||=$1;$min=$1<$min?$1:$min/eg; print "Min: $min$/"; print "Max: $max"; __END__ --Dave
