Converting .fio to .dat files

The following script converts all .fio files of a directory to .dat files.

#!/usr/bin/perl -w
#
# convert .fio to ASCII files
#
# the column descriptions are copied to comments
# 
use strict;

my @files = <*.fio>; 

my @lines; 
foreach my $file (@files)
{
    next if( $file !~ /\.fio/);
    print "Converting $file \n"; 
    @lines = `cat $file`;
    $file =~ /(.+)\.fio/;
    my $temp = "$1" . ".dat";
    if( -e "$temp")
    {
	print "\007\n\n $temp exits \n\n";
	goto finish;
    }
    my $flag_found_data = 0;
    #
    # open the output file
    #
    open FILE, "> $temp";
    foreach my $line (@lines)
    {
	chomp $line;
	#
	# skip all files unti '%d'
	#
	if( $line =~ /\%d/i)
	{
	    $flag_found_data = 1;
	    next;
	}
	if( $flag_found_data)
	{
	    #
	    # the '!' may indicate a comment
	    #
	    if( $line =~ /col/i)
	    {
		print FILE "! $line \n";
	    }
	    else
	    {
		print FILE "$line \n";
	    }
	}
    }
    close FILE;
}
finish: