Perl implementation of the which utility as an API
