You could run through the keys and do a pattern match on each one, like:
my %cat = ('something' => 'stuff',);
my $variable = 'something';
my $match;
while (my ($key, $value) = each %cat) {
if ($variable =~ /$key/) {
$match = $value and last;
}
}
Unfortunately this really nullifies the primary usefullness of a hash, e.g., efficient and straightforward dictionary lookup. What would be a better solution, if you can change the manner in which you store your data, is to use Tie::Hash::Regex, which enables you to use a regular expression to do key lookups. Very spiffy IMO, and written by a couple of local monks too.
Update: fixed two typos in the code snippet.