Also, you are performing a regex on the return value which may be undef.I would think you should do the regex before you return the field if (log that too)
excuse me but i don't understand, here i'm not returning the value of the field but the returning value of the regexp which i think can be only 0 or 1 but i maybe wrong.
do you mean that my sub can return 'undef' in some cases ?