open (LECTOR1, "$datainfo/students_creados") || die "ERROR: NO Encuentro
el archivo 'students_creados'\n";
while (<LECTOR1>) { #PRIMER WHILE
chomp;
@linea = split;
$login = $linea[7];
if ($name[0] =~ /$login/i){
$count1 += 1;
if ($count1 > 1){
This only compares the name in $login to the first record in @name - you
may have meant:
if ( $name[$i] =~
but that way lies madness. You're looping through the file once, then once
more for each name found, which'll soon combinatorilly explode on you. A
hash (untested):
my %names;
open (LECTOR, "$datainfo/students_creados")
or die "ERROR: NO Encuentro el archivo 'students_creados': $!\n";
# always use $!
while (<LECTOR>) { #PRIMER WHILE
chomp;
my @linea = split;
# upper case name to make matches easier
my $login = uc($linea[7]);
$names{$login}++;
}
close LECTOR;
open (PRINTER, ">>$datainfo/repeticiones");
or die "ERROR: NO puede abrir $datinfo/repeticiones": $!\n";
my $name;
foreach $name ( keys %names ) {
print PRINTER "$key $names{$name}\n"
if $names{$name} > 1;
}
close PRINTER
Andy Bach, Sys. Mangler
Internet: [EMAIL PROTECTED]
VOICE: (608) 261-5738 FAX 264-5030
"If you don't say anything, you won't be called on to repeat it"
Calvin Coolidge
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs