Fixed compatibility issues with perl >= 5.18

Remove an unnecessary usage of smartmatch.  This has been marked
experimental in newer perl, which generates warnings on use,
causing test failures.  The intent was to let the code work with
regexes and plain strings, but since the code was only ever used
with regexes, simply change to =~.

Remove a wrong usage of defined() on an array.  This code didn't
mean what the author thought it meant (see perldoc -f defined),
and using it this way is now deprecated, generating a warning.

Change-Id: I388bb2e4cbd16ea468db099593763cfed9953f23
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@digia.com>