Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: not able to compare files
by NetWallah (Canon) on Mar 12, 2004 at 05:12 UTC | |
by arden (Curate) on Mar 12, 2004 at 05:46 UTC | |
|
Re: not able to compare files
by nandeya (Monk) on Mar 12, 2004 at 05:34 UTC | |
|
Re: not able to compare files
by pbeckingham (Parson) on Mar 12, 2004 at 05:30 UTC |