This the code I use for compare, and works, but I don't know how to update the file2, I hope you understand me
#!/usr/bin/perl use strict; my file1 = "path to file"; my file2 = "path to file"; open(FILE1, "<$file1") || die; # just read open(FILE2, "+<$file2") || die; # for update it foreach $nomina (<FILE1>) { my $match = 0; my @nomina = split /|/, $nomina; foreach $bucareli (<FILE2>) { @bucareli = split /\|/, $bucareli; if ( $nomina[3] == $bucareli[3] ) { if ( $nomina[0] == $bucareli[0] ) { $match = 1; } } } if ( $match == 1 ) { print FILE2 "$nomina[0]\n"; } } ----- Original Message ----- From: "Wiggins d'Anconia" <[EMAIL PROTECTED]> To: "Rafael Morales" <[EMAIL PROTECTED]> Subject: Re: update file Date: Thu, 14 Jul 2005 10:56:54 -0600 > > Rafael Morales wrote: > > Hi list. > > > > I have two files which I compare: > > first file: > > 813|42006|34913|373376|SALAZAR/BERLANGA/JUAN FRANCISCO > > K00|42004|999999|489545|FAUSTO/PERALTA/PORFIRIO > > 900|72059|2031|237648|CAZARES/GUTIERREZ/ALEJANDRO > > 211|42005|34913|86258|GUZMAN/DIAZ/CARLOS NOE > > > > second file: > > 000|42006|34913|373376|SALAZAR/BERLANGA/JUAN FRANCISCO > > 111|42004|999999|489545|FAUSTO/PERALTA/PORFIRIO > > 222|72059|2031|237648|CAZARES/GUTIERREZ/ALEJANDRO > > 333|42005|34913|86258|GUZMAN/DIAZ/CARLOS NOE|20050609 > > > > As you can see the first column is different so I need to update > > the second file for both files have the same values, how could I > > do it ??? > > Note: My comparison works fine, I just need update it. > > > > Thanks and regards !!! > > > > What have you tried? Where did it fail? Show us some code. > > perldoc perlopentut > perldoc Tie::File > perldoc DBD::CSV > > http://danconia.org > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> -- _______________________________________________ Get your free email from http://mymail.bsdmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>