use strict;
use warnings;
use 5.010;

 
 my ($filename, $year, $month, $day, $name1, $xp1, $yp1, $zp1, $name2, $xp2, $yp2, $zp2, $name3, $xp3, $yp3, $zp3, $name4, $xp4, $yp4, $zp4, $name5, $xp5, $yp5, $zp5, $name6, $xp6, $yp6, $zp6)=@ARGV;

 open(my $fh, '>>', $filename) or die "Could not open file '$filename' $!";
 
 if (defined $name2  eq "") {
   


say $fh "IGS14 coordinates for BERNESE GNSS SOFTWARE 5.2,\n--------------------------------------------------------------------------------\nLOCAL GEODETIC DATUM: IGS14_0           EPOCH: $year-$month-$day 00:00:00 \n\nNUM  STATION NAME           X (M)          Y (M)          Z (M)     FLAG\n\n  1  $name1 $name1         $xp1   $yp1   $zp1   PPP";
			
close $fh;	
    print " > only one point entered correctly\n";
}
elsif (defined $name3  eq "") {
 


say $fh "IGS14 coordinates for BERNESE GNSS SOFTWARE 5.2,\n--------------------------------------------------------------------------------\nLOCAL GEODETIC DATUM: IGS14_0           EPOCH: $year-$month-$day 00:00:00 \n\nNUM  STATION NAME           X (M)          Y (M)          Z (M)     FLAG\n\n  1  $name1 $name1         $xp1   $yp1   $zp1   PPP\n  2  $name2 $name2         $xp2   $yp2   $zp2   PPP";
	close $fh;			

    print " > only two point entered correctly\n";
}
 
 elsif (defined $name4  eq "") {
   


say $fh "IGS14 coordinates for BERNESE GNSS SOFTWARE 5.2,\n--------------------------------------------------------------------------------\nLOCAL GEODETIC DATUM: IGS14_0           EPOCH: $year-$month-$day 00:00:00 \n\nNUM  STATION NAME           X (M)          Y (M)          Z (M)     FLAG\n\n  1  $name1 $name1         $xp1   $yp1   $zp1   PPP\n  2  $name2 $name2         $xp2   $yp2   $zp2   PPP\n  3  $name3 $name3         $xp3   $yp3   $zp3   PPP";
close $fh;				

    print " > only three point entered correctly\n";
}
 
 elsif (defined $name5  eq "") {
  


say $fh "IGS14 coordinates for BERNESE GNSS SOFTWARE 5.2,\n--------------------------------------------------------------------------------\nLOCAL GEODETIC DATUM: IGS14_0           EPOCH: $year-$month-$day 00:00:00 \n\nNUM  STATION NAME           X (M)          Y (M)          Z (M)     FLAG\n\n  1  $name1 $name1         $xp1   $yp1   $zp1   PPP\n  2  $name2 $name2         $xp2   $yp2   $zp2   PPP\n  3  $name3 $name3         $xp3   $yp3   $zp3   PPP\n  4  $name4 $name4         $xp4   $yp4   $zp4   PPP";
			
close $fh;	
    print " > only four point entered correctly\n";
}
elsif (defined $name6  eq "") {
  

say $fh "IGS14 coordinates for BERNESE GNSS SOFTWARE 5.2,\n--------------------------------------------------------------------------------\nLOCAL GEODETIC DATUM: IGS14_0           EPOCH: $year-$month-$day 00:00:00 \n\nNUM  STATION NAME           X (M)          Y (M)          Z (M)     FLAG\n\n  1  $name1 $name1         $xp1   $yp1   $zp1   PPP\n  2  $name2 $name2         $xp2   $yp2   $zp2   PPP\n  3  $name3 $name3         $xp3   $yp3   $zp3   PPP\n  4  $name4 $name4         $xp4   $yp4   $zp4   PPP\n  5  $name5 $name5         $xp5   $yp5   $zp5   PPP";
		close $fh;		

    print " > only fimm point entered correctly\n";
} else{
   say $fh "IGS14 coordinates for BERNESE GNSS SOFTWARE 5.2,\n--------------------------------------------------------------------------------\nLOCAL GEODETIC DATUM: IGS14_0           EPOCH: $year-$month-$day 00:00:00 \n\nNUM  STATION NAME           X (M)          Y (M)          Z (M)     FLAG\n\n  1  $name1 $name1         $xp1   $yp1   $zp1   PPP\n  2  $name2 $name2         $xp2   $yp2   $zp2   PPP\n  3  $name3 $name3         $xp3   $yp3   $zp3   PPP\n  4  $name4 $name4         $xp4   $yp4   $zp4   PPP\n  5  $name5 $name5         $xp5   $yp5   $zp5   PPP\n  6  $name6 $name6         $xp6   $yp6   $zp6   PPP";
 		
		
	close $fh;	
	print " > only sex point entered correctly\n";
	}	
say 'done';