#!/usr/bin/perl use strict; # create data structure my $LOG = {}; $LOG->{A} = []; # $LOG->{A}[0] is the same as $LOG->{A}->[0] # is the same as $$LOG{A}->[0] # create anonymous file handle $LOG->{A}[0] = do { local *FH }; # open file for writing, assign to anon file handle open($LOG->{A}[0], ">dummy.txt") || die "Unable to open test file."; # unable to print directly to the pointer, so we select it instead select($LOG->{A}[0]); print <{A}[0]);