sub validate_owner{ my ($str) = @_; print "Owner is $str in sub_validate_owner\n" if ($debug); # Remove leading and trailing whitespace. $str =~ s{\A \* | \s* \z}{}gxm; if ($str =~ /nbk[A-z0-9]{4}/ or /nbd[A-z0-9]{4}/ or /root/){ print "Error $str is not a valid job owner\n"; $error = 1; return 1; } else { #No match for string. return; } } if (defined $jobs{'owner'}){ my $owner = $jobs{'owner'}; # Split id@hostname and get the id value. $owner = (split /@/,$owner)[0]; print "Owner ID is $owner\n" if ($debug); validate_owner($owner); }