syntax error in perl

hi..
i have two perl code that create .csv files and the other create .txt file.
How to create both by conbining these 2 sets of codes up?
Keep getting syntax error when i tried tt..


CREATE .csv files
my($csv) = Text::CSV->new;
open( CSV, ">$file.csv") || die "Failed for $file.csv: $!\n";

# Write Header
$csv->combine( qw/Qin Qout Yield Reject/);
print CSV $csv->string . "\n";

# Write data using foreach or some other loop.
  $csv->combine( @{$t} );
  print CSV $csv->string . "\n";

close( CSV );
__________________________________________________________________________________

CREATE text files
die "$file already exists\n" if -f $file;
open FILE, ">$file" or die "Can not create $file $!\n";

#print the sums at the top of the file, separated by tabs
print FILE "Daily Yield Report Summary\n";
print FILE "Device: '$dev'\n";
print FILE "Date: '$datef' to '$datet'\n\n";
print FILE "Date\t\t", "Qin\t", "Qout\t", "Yield\t", "Reject\t", "Lot\n";
foreach my $r(@$d) {
print FILE join("\t", @$r), $/;}

#write the other arrays in tab-separated columns underneath the sums
 print FILE  "-"x60, $/;
 print FILE "Total\t\t", join("\t", @$t), $/;

# Graph
print FILE $graph->to_string( [("\t", @$t), $/],
                           labels => [ qw/, ,Qin, Qout, Yield, Reject/ ],
                         );
close(FILE);
TPolyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TintinCommented:
There's not enough info to go on.

You can quite easily combine the two code snippets, but without seeing what's wrapped around them and what the syntax error you got, it's not possible to help.
0
TPolyAuthor Commented:
error msg:
Unmatched right curly bracket at graphtxtcvs.tk line 28, at end of line
  (Might be a runaway multi-line "" string starting on line 20)
syntax error at graphtxtcvs.tk line 28, near "}"
Execution of graphtxtcvs.tk aborted due to compilation errors.

the codes:

        $ca->createImage(5,2,
        -anchor =>'nw',
        -image => image1);

        $ca->pack(-side=>'top');


        $text =
$fr2->ROText('-width'=>85,'-height'=>30,
        -font=>['time new roman','10'],-background=>'white')->pack(-side=>'bottom');


        my $scr2 = $fr2->Scrollbar(-command =>['yview',$text]);
       
$text->configure(-yscrollcommand=>['set',$scr2]);
        $text->pack(-side => 'left', -fill =>'both');
        $scr2->pack(-side => 'right', -fill => 'y');

        $text->insert('1.0',"This program is licensed
to Agilent Technologies Singapore (HSIO)\n
search.tk is created by Dawn Lee and Joyce Khoo,
Diploma in Info-Communications(IFC)\n
This program allows the user to search the directory
for 'Yield Report', 'Tray Report'
and 'Packagae Report'\n
Copyright(c) 2004 Temasek Polytechnic\n" );
        }

sub condition1()
{

#Get entry
        $devf=$f->get('active');
        $dev=$d->get('active');
        $datef=$entry2->get;
        $datet=$entry3->get;
        $file=$entry->get;
      $year=$entry4->get;

if ($devf eq "" && $year eq ""){

#connect to the database
my $dbh = DBI->connect('dbi:mysql:rvsi','','', {RaiseError=>1, PrintError=>1});

# Extract the data from database
my $d = $dbh->selectall_arrayref("SELECT date, qin, qout,yield, reject, lot FROM yield WHERE date BETWEEN '$datef' AND '$datet'");
    print ("Daily Yield Report Summary for '$dev' between '$datef' to '$datet'\n\n");
    print ("Date\t\t", "Qin\t", "Qout\t", "Yield\t", "Reject\t", "Lot\n");

# Print out all the array catch  
foreach my $r(@$d) {
    print join("\t", @$r), $/;
}

#print the dotted line
print "-"x60, $/;

#Do the calculation
my $t = $dbh->selectrow_arrayref("SELECT sum(qin), sum(qout), ((sum(qout)/sum(qin))*100), sum(reject) FROM yield WHERE date BETWEEN '$datef' AND '$datet'");
print "Total\t\t", join("\t", @$t), $/;

#Create Graph
my $graph = Text::Graph->new( 'Bar' );
  print $graph->to_string( [("\t", @$t), $/],

                           labels => [ qw/, ,Qin, Qout, Yield, Reject/ ],
                         );

my($csv) = Text::CSV->new;
open( CSV, ">$file.csv") || die "Failed for $file.csv: $!\n";

# Write Header
$csv->combine( qw/Qin Qout Yield Reject/);
print CSV $csv->string . "\n";

# Write data using foreach or some other loop.
  $csv->combine( @{$t} );
  print CSV $csv->string . "\n";

close( CSV );


die "$file already exists\n" if -f $file;
open FILE, ">$file" or die "Can not create $file $!\n";

#print the sums at the top of the file, separated by tabs
print FILE "Daily Yield Report Summary\n";
print FILE "Device: '$dev'\n";
print FILE "Date: '$datef' to '$datet'\n\n";
print FILE "Date\t\t", "Qin\t", "Qout\t", "Yield\t", "Reject\t", "Lot\n";
foreach my $r(@$d) {
print FILE join("\t", @$r), $/;}

#write the other arrays in tab-separated columns underneath the sums
 print FILE  "-"x60, $/;
 print FILE "Total\t\t", join("\t", @$t), $/;

# Graph
print FILE $graph->to_string( [("\t", @$t), $/],
                           labels => [ qw/, ,Qin, Qout, Yield, Reject/ ],
                         );

close(FILE);
}
}




0
ozoCommented:
       $text->insert('1.0',"This program is licensed
to Agilent Technologies Singapore (HSIO)\n
search.tk is created by Dawn Lee and Joyce Khoo,
Diploma in Info-Communications(IFC)\n
This program allows the user to search the directory
for 'Yield Report', 'Tray Report'
and 'Packagae Report'\n
Copyright(c) 2004 Temasek Polytechnic\n" );
        }
This  ^   right bracket has no corresponding left bracket.
The beginning of the file seems to be missing something.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.