sub test { my ($file) = @_; open(my $fh, '>>', "$file") or die("failed to open file"); # prints content close($fh); }