in reply to use of uninitialized value

The code i used is below, and i have no idea where i went wrong! please help.

Sure you do, perl told you a linenumber :)

my tips , use autodie; so it error checks your open/close calls

And strict/warnings ( Read this if you want to cut your development time in half! )

And use meaningful variable names (words not letters)

Then employ Basic debugging checklist and/or brian's Guide to Solving Any Perl Problem to figure out which variable is uninitialized and why it happens (basically  warn Dumper( ... ); )

Then you'll have a better idea of where you're going wrong, and then you can think of strategies to fix it; for example, expanding the scope of some of these variables you want to reuse ( Lexical scoping like a fox )

If you're game, I'm game ; I'll play if you'll play