http://qs321.pair.com?node_id=209278


in reply to Need help with a variable

Everything in the BEGIN scope is always compiled executed before everything else even if in your script BEGIN {} is at the end.

$var = "VARIABLE"; END {print "this is at the end:$var\n";} BEGIN {print "this is in the beginning:$var\n";} ##OUTPUT: $ perl script.pl this is the beginning: this is at the end:VARIABLE

Try running your script without the BEGIN.

--
hiseldl
What time is it? It's Camel Time!