my @contents; &open_file(myfile.txt); sub open_file { open(FILE, "$_[0]") || die "could not open FILE $_[0]: $!"; @contents = ; close(FILE); }