in reply to vars going out of scope!

Although this is not directly related to your problem, I suspect that the line:

my @array = qq(bla bla2 bla3);

is not what you want here.

This assigns the scalar "bla bla2 bla3" to the first element of @array. I imagine you wanted:

my @array = qw(bla bla2 bla3);.