in reply to basic perl question
You have to declare your variables with strict and warnings.
e.g. my @records or possibly our @records
This might have been better asked in the chatterbox