There are a number of things here that you probably don't mean to be doing, but for starters:
- Why do create a variable (my $question_id = $_[0];) but never use it again?
- Assigning "" to an array does not give you an empty array, it gives you an array with
one null element. You can assign () to an array to make it empty, but in this case it is a new
variable and so the assignment is not needed (arrays come empty from the factory).
- Opening with '+<' means read/write access which is not too useful with a text file
unless you have a fixed line length and are keeping track of your position (and you are
doing both reading and writing which you aren't). You probably
just want '>' which truncates the file if it exists and opens it for output only.
If you need more help, then you should supply more context such as what exactly
does happen (with the benefit of using $! as ar0n suggested), and what is in all the global variables that this subroutine
is using.
--
I'd like to be able to assign to an luser