Probably more efficient ways to do, but wanted to blow a minute or two before I went to bed.
#!perl
use strict;
my (%schds, %conts, %in_conts_not_schds);
open( MILF, "C:/junk/scheduled.txt" ) or die "Can't open scheduled.txt
+\n";
while( <MILF> ) {
split(/\s+/,$_);
$schds{lc(@_[0])}=1;
}
close MILF;
open( CONT, "C:/junk/contact.txt" ) or die "Can't open contact.txt\n";
while( <CONT> ) {
split(/\s+/,$_);
$conts{lc(@_[0])}=[@_[0], @_[1]]; #Retain case of name
}
close CONT;
foreach (keys %conts) {
unless (exists $schds{$_}) {
$in_conts_not_schds{$conts{$_}->[0]} = $conts{$_}->[1];
}
}
foreach (sort keys %in_conts_not_schds) {
print "$_ $in_conts_not_schds{$_}\n";
}
___END... FILES FOLLOW____
scheduled.txt
Sam 5:00
scott 4:45
saleem 5:00
Ken 7:00
Ken 8:00
contact.txt
sam 324-232-3333
Joe 235-309-3333
Saleem 323-747-0000
Ken 764-636-9999
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.