or shorter:my $outfile = "userfile.txt"; # or whatever .... unless (open (OUTFILE, ">$outfile")) { # open file for writing die "Error: couldn't write to file $outfile: $!"; } # unless else { foreach my $element (@DATA) { print (OUTFILE "$element\n"); } # foreach # or: print (OUTFILE "$_\n") foreach @DATA; # or: print (OUTFILE map { "$_\n" } @DATA); close (OUTFILE); } # else
open (OUTFILE, ">$outfile") or die "Error: couldn't write to file $outfile: $!"; print (OUTFILE "$_\n") foreach @DATA; close (OUTFILE);
With mailing, I can't help you until I know which operating system you are working with. If you use Unix or Linux, have a look at sendmail, or if you are working with Windows, I prefer using Blat.
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"
In reply to Re: create a file from an array
by strat
in thread create a file from an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |