That particular use of for sets the $_ to whatever was in $@. The code as presented doesn't do anything useful with $_, so you can replace it with if($@). The for expression is normally a looping construct, but it isn't be used that way here.
The single quotes around $@ are also probably incorrect. You'll need double quotes so you can print out the value of $@. Or just leave them off entirely and Perl will do the Right Thing in this case.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.