#! /usr/bin/julia

# Rosetta Code, CSV data manipulation

ifn = "csv_data_manipulation_in.dat"
ofn = "csv_data_manipulation_out.dat"

ifile = open(ifn, "r")
(a, h) = readcsv(ifile, Int, header=true)
close(ifile)

a = hcat(a, sum(a, 2))
h = hcat(h, "SUM")
a = vcat(h, a)

ofile = open(ofn, "w")
writecsv(ofile, a)
close(ofile)
