Writing Excel as CSV

< ^ >

    #!/usr/bin/perl -w

    use strict;

    my $data =  [
                    ['Area',    'Sales'      ],
                    ['East',    '150'        ],
                    ['West',    '100'        ],
                    ['Total',   '=SUM(B2:B3)'],
                ];

    open CSV, ">new_csv.csv" or die "Couldn't open file. $!\n";

    for my $aref (@$data) {

        # !! Use a module here.
        my $data = join ',' , @$aref;

        print CSV $data, "\n";
    }

    __END__