Try putting a "my" (without quotes) before the variable. What that will do is 
to make it global so any function as well as the main part of your code will 
be able to access it (then you won't need to put it within sub addEmail).
Sometimes though, you want only the function to be able to access a variable 
because that'll be the only place it's used. Once the function is started, 
the variable is created. Once it has finished executing, any local variables 
(i.e. those declared with "my" inside a function), will be destroyed.

You should also put "use strict;" at the top of your script.

Look at "perldoc perlsub" and "perldoc strict".

Geraint.

Reply via email to