use strict; # Always use strict local *FILE; # This declares FILE as a local variable. # This is NOT necessary for variables with # UPPERCASE names, as strict # ignores these, see [jcwren]s post # below for an excellent explanation. # But localizing a file variable prevents # us from messing up other variables of # the same name. open FILE, "> $filename" or die "Couldn't create '$filename': $!\n"; binmode FILE; # do your stuff close FILE;