#!/usr/bin/perl

use strict;

my $infile="input.txt";

sub fnutta {
	my $foo = shift;
	if (lc($foo) eq "null") { return $foo; } 
	if ($foo =~ /^\d+$/) { return $foo; }
	return "'" . $foo . "'";
}


open(CSV, $infile) or die("Could not open $infile!\n");

while (<CSV>) {
	chomp;
#	my ($begreppid, $beteckning, $enhetid)
	@a = split(/;/);
	print "insert into BEGREPP (BEGREPPID, BETECKNING, ENHETID) values (" .
#			fnutta($begreppid) . ", " . fnutta($beteckning) . ", " .
#			fnutta($enhetid) . ")\n";
			fnutta($a[0]) . ", " . fnutta($a[1]) . ", " .
			fnutta($a[2]) . ")\n";
}

