In order to generate a csv file, just you need to open a filehandle a start writing on it:
e.g.
#!/opt/nokianms/bin/perl
unlink ($RESULTS) and print "$RESULTS deleted" or print "$RESULTS does not yet exist\n";
open DCN, ">>$RESULTS" or die "Can't open $RESULTS: $!\n";
print DCN "BSC,CNUMBER,UNIT,INTERFACE,IP ADDRESS,CONNECTION,STATE";
.
.
.
.
.
first query
inside the loop of your query
{
print DCN "$bsc,$cnumber,$unit,$interface,$ip,$connection,$status";
}
second query
{
print DCN "$bsc,$cnumber,$unit,$interface,$ip,$connection,$status";
}
close DCN
or even you can have the results of each query in different arrays and then print the content of the array to the filehandle.
print DCN @queryresults;
dmazzini
GSM System and Telecomm Consultant