PERL es mejor que una Escoba :) jejejejeje

bitfrost's picture

open(MYINPUTFILE, "; # read file into list
@lines = sort(@lines); # sort the list
my($line);
foreach $line (@lines) # loop thru list
{
#print "$line"; # print in sort order
$line =~ s/,/]/g;
#$line =~ s/]]/]/g;
#$line =~ s/]]/]/g;
#print $line;
my @campos2 = split(/]/,$line);
chomp $campos2[0];
$campos2[0] =~ s/'//g;
chomp $campos2[1];
chomp $campos2[2];
chomp $campos2[3];
chomp $campos2[4];
chomp $campos2[6];
chomp $campos2[7];
chomp $campos2[11];
chomp $campos2[17];
chomp $campos2[18];

$campos2[0] =~ s/\s+$//;
$campos2[1] =~ s/\s+$//;

$campos2[3] =~ s/\s+$//;
$campos2[2] =~ s/\s+$//;

$campos2[6] =~ s/\s+$//;
$campos2[7] =~ s/\s+$//;
$campos2[12] =~ s/\s+$//;
$campos2[17] =~ s/\s+$//;
$campos2[18] =~ s/\s+$//;

print "\n";

print "Codigo: $campos2[0]\n";

print "Nombre: $campos2[1]\n";

print "Telefono: $campos2[2]\n";

print "Documento: $campos2[6]\n";
printf ("Numero: %.0f \n", $campos2[7]);
print "Vence: $campos2[11]\n";
printf ("TOTAL: %.2f \n", $campos2[17]);
printf ("Dias: %.0f \n", $campos2[18]);

#;
}
close(MYINPUTFILE);