The main thing im concerned about is ...
Code:
if($text=~/accessories/i && $class == 'ranger')
The accepted operator for strings in perl is 'eq' not '=='.. and is considered a syntax error if interchanged because it can hinder or break performance.
The other thing is the use of &&.. its usually better to have multiple if statements..but thats just the way I would do it
If you fix your string operators, Ill sticky it