While your efforts to honor the brevity requirement for posted code snippets is admirable -- and I truly mean this and thank you for making the effort -- it is often critical to also honor the functional requirement.
That said, some notes:
#!/usr/bin/perl use strict; my $csvfile; push (@report,(join "\t", $empid, @array),"\n") foreach (@report) { print $_; print $csvfile $_; } exit; __END__
Produces:
C:\Steve\Dev\PerlMonks\P-2013-07-11@1436-CSV-Fail>perl csvfail.pl Global symbol "@report" requires explicit package name at csvfail.pl l +ine 6. Global symbol "$empid" requires explicit package name at csvfail.pl li +ne 6. Global symbol "@array" requires explicit package name at csvfail.pl li +ne 6. Global symbol "@report" requires explicit package name at csvfail.pl l +ine 7. syntax error at csvfail.pl line 7, near ") {" syntax error at csvfail.pl line 10, near "}" Execution of csvfail.pl aborted due to compilation errors.
Because I can see where you're going with this data, I will play with the code and see if I can produce a small version which facilitates debugging.
See you in a few minutes. :-)
In reply to Re: Write array contents to csv file
by marinersk
in thread Write array contents to csv file
by learner@perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |