Rewriting the script

A new gen_gpi_file.pl is rewritten following Sidd excellent
recommendations
gen_gpi_file.pl v1

Incorporating Sidd suggestions