in reply to Strange Error From BEGIN

Turn on Warnings, and use strict
#!/usr/bin/perl -w
It will help you track down bugs a lot easier.