sub write_list { my $outfile = "/home/foo/bar"; open (OUT, ">$outfile") or &print_error ("Can't open $outfile: $!"); foreach $i (@changes) { print OUT $i; } close (OUT) or print_error ("Can't close $file properly: $!"); }