VSarkiss's remarks are correct.
One additional point: it is a good thing to die with a message on a failed open like you do. Adding the magical variable $!
will give the error system and make the message really helpful. It is good to know there is a failure at a given point, it is better to know the cause of the failure. For information on $!, see
perlvar
-- stefp