#!/usr/bin/perl -w use strict; sub test { my ($param) = @_; my $rc = 0; if ($param =~ /e/) { $rc = 1; } elsif ($param =~ /a/) { $rc = 2; } return($rc); }; my @tsts = qw/ test toast kitty /; foreach my $word (@tsts) { my $ret_val = &test($word); if ($ret_val == 1) { print "E found\n"; } elsif ($ret_val == 2) { print "A found\n"; } else { print "A or E NOT found\n"; } }