in reply to Output to file question

Here's another way, using the Tie::File module:
#!/usr/bin/perl use strict; use warnings; use Tie::File; my $mac = "this is the variable to be written to a file"; # tie array to output file tie my @array, 'Tie::File', "outputfile.txt" or die "can't open file: +$!"; # write $mac to file push @array, $mac; # all finished untie @array; __END__