# This script takes data in tab-delimited format and convert the data into ARFF format.
# Pengyi Yang

use strict;
use warnings;

open(I, $ARGV[0]);

print "\@relation ARFF\n\n";

my $h = <I>;
my @att = split(/\s+/, $h);

for (my $i = 0; $i < @att - 1; $i++) {
	print "\@attribute $att[$i] numeric\n";
}

print "\@attribute class {0, 1}\n\n";
print "\@data\n";

while(<I>){
	chomp;
	$_ =~ s/\s+/,/g;
	print "$_\n";
}
close(I);
