#!/usr/bin/perl -w use strict; open TMP, "> file.tmp" or die "Couldn't open file: $!\n"; my %hash; $hash{tmpfile} = \*TMP; print {$hash{tmpfile}} "hello, world\n";