what I am doing is trying to print the contact of the person who is not in the schedul , in my example I will need to only print Joe 235-309-3333 My code is doing it wrong and also check for ken who is schedul twice , two times which I dont' want . If the person is schedul then I don't need to print it . Can you help?scheduled contact.txt --------- ----------- Sam 5:00 sam 324-232-3333 scott 4:45 Joe 235-309-3333 saleem 5:00 Saleem 323-747-0000 Ken 7:00 Ken 764-636-9999 Ken 8:00 open (FILE1, '<', 'scheduled') or die "Unable to open file1.txt for re +ading : $!"; open (CONTACT, '<', 'contact.txt' ) or die "Unable to open contatct.tx +t: $!"; while (my $list = <CONTACT>) { chomp $list; my @names = split(/ /, $list); my $name = ($names[0]); open (FILE3, '>>', 'Available') or die "Unable to open Tuesday.rep for + writing : $!"; while (my $line = <FILE1>) { chomp $line; unless ($line =~ m/^$name/) { #print FILE3 "$list\n"; print " the line is $list\n"; print " the sched is $line\n"; } } }
In reply to not able to compare files by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |