in reply to not getting desired output

jwkrahn's suggestion fixes your problem, but might I also suggest you change your second regex? It's difficult to read for what it does.

$line =~ /Authentication mechanism returned \[(\d+)\]/

OK, so it's not that much easier to read...