#!/usr/bin/perl -w
$readfile = "simplecin.txt";
open ($filein, '+<', "$readfile" )
    or die "cannot open $readfile: $!";
@fileContents = ();
while  ($buf = <$filein> ){
# remove /n
chomp($buf) ;

($x, $y, $z) = split( /[,; ]/, $buf) ;
# (splits at , char )
printf "%s;%s;%s\n", $x, $y, $z;
$outstring = $x . ";" . $y . ";" . $z. "\n";
push @fileContents, $outstring;}
seek $filein, 0, 0 
  or die "cannot seek : $!";
print $filein "a header line \n";
print $filein  @fileContents;
truncate $filein, tell ($filein);


    

