in reply to Unassociated Filehandles and Subroutines

The simplest modification to your routine is

sub myopen { my ($file, $mode, $locktype) = @_; local *FH; ## Ensure that we get a new GLOB each time #open the file...for the sake of brevity #I'll not include the mode logic here if (open FH, "$file"){ print "Opened $file successfully.\n"; #lock the file #do whatever else needs to be done return *FH; } else { warn "Can't open: $!\n"; } }

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon