my $data = '...'; open(my $fh, '<', \$data) or die; sub_that_needs_file_handle($fh);