Dear all,

I am just learning perl.
i have the following code

#!c:/perl/bin/perl -w

use warnings;
use strict;

my $file =  'C:/Perl/20060920_1.csv';
open FH, $file or die $!;
while(defined($file=<FH>)){
  my @file = split/,/, $file;
  print qq($file[0], $file[1], $file[10], $file[9], $file[12], $file[13]\n);
}

the output produce is :

C:\Perl>perl cdr.pl
15991650, 2348060000000, 9/20/2006 9:16, 9/20/2006 9:16, 6, ANSWERED

15991605, 2348060000000, 9/20/2006 9:18, 9/20/2006 9:17, 69, ANSWERED

15991605, 2348060000000, 9/20/2006 9:39, 9/20/2006 9:38, 57, ANSWERED

, , , , ,

, , , , ,

, , , , ,

, , , , ,

, , , , ,

, , , , ,

, , , , ,


C:\Perl>

how can I remove all the excess commas produce?

again i want to sum all the $file[12], how can i achieve this?

i am yet to know how to use module, cos am just into perl.

Thank you

Attachment: 20060920_1.csv
Description: MS-Excel spreadsheet

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Reply via email to