in reply to Output to file question
I just want to mention, since it sounds like you are a beginner in Perl, that the method given by ysth will overwrite the contents of your file. If you want to append to a file, you need to open the file as
open my $handle, ">> filename" or die "Couldn't open file: $!";
Note the ">>" instead of ">".
You can print anything else to the file using
until the close command is executed on $handle.
open my $handle, ">> filename" or die "Couldn't open file: $!";
Note the ">>" instead of ">".
You can print anything else to the file using
print $handle "Hello, world\n"; print $handle $some_other_var;
until the close command is executed on $handle.
In Section
Seekers of Perl Wisdom