#!/bin/sh bestv=0 for p in $(whereis perl) do if [ "$p" != "${p%bin/perl}" ]; then v=$($p -V:PERL_VERSION | sed "s/[^']*'//;s/'.*\$//") if [ $v -gt $bestv ]; then best=$p bestv=$($p -V:PERL_VERSION | sed "s/[^']*'//;s/'.*\$//") fi fi done echo $best