don't rely on error global after eval
don't reuse variable names in scope
more checking return of eval
remove unneeded initializations
dead code
remove unused variables
use regex with split
trailing comma instead of semicolon
fix punctuation and formatting
use any instead of grep when all we're looking for is the first one
use three-arg open(), not two-arg
use strict
change foreach to map