Greg Wardawy wrote:

> I've modified Douglas' code as following:
> 
> my %nostock;
> while (<NOSTOCK>) {
> s/,.*//;
> $nostock{$_}= 1;
> print;
> }
> 
> while (<ORD>) {
> my ($item) = (split(/,/))[4];
> print  unless $nostock{$item};
> }
> 
> but the output I got is:
> PENFUZZY                                # it's in the hash
> FNWDISPLAY
> HAVCASTLE
> HAVCONSTRUCTION
> HAVEASYFAMILY
> HAVMASTERCKDLX
> MERNEWBAKING
> MORHORSD
> STRSMALL
> TLCELMOART
> TLCLITTLEBEAR
> TLCMADELINE
> WARLITTLEMEALS
> 3,1000000005,R496055,348,PENFUZZY,11.99,1,04,25,00      # it 
> shouldn't be 
> printed
> 3,1000000005,R496055,348,RDPILOT,7.99,1,04,25,00
> 3,1000000005,R496055,351,HOUWHERE,4.95,1,04,25,00
> 3,1000000005,R496055,351,PENDINNER,6.95,1,04,25,00
> 3,1000000005,R496055,351,RANONEFISH,8.95,1,04,25,00
> 3,1000000005,R496055,351,SIMCHEERIOS,5.99,1,04,25,00
> 
> What am I doing wrong? Can somebody explain it me? TIA.
> Greg

Try chomping your input line before putting it in the hash.  Each hash entry
has a trailing newline; when you do your compare, $item doesn't have that
unless it's the last item on the line.

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to