Thanks Douglas,
I'm reposting plain text:
To: "Perl-Win32-Users Mailing List" 
<[EMAIL PROTECTED]> Subject: Extracting lines
Hello all,
I need to print just the lines where the fourth element is not a member of 
the second list so I wrote the following code:
####################
#!perl -w
open(NOSTOCK, "< nostock.csv") || die "can't open nostock.csv for reading: 
$_!";
open(ORD, "< custord2") || die "can't open custord2 for reading: $_!";
open(CUST, "> cust") || die "can't create cust: $_!";
my ($line, @ord, $i, $aref, @nostock, $bref, $n, $j);
while ($line = <NOSTOCK>) {
push @nostock, [ split ',', $line ];
}
while ($line = <ORD>) {
push @ord, [ split ',', $line ];
}
ORD: for $i ( 0 .. $#ord ) {
$aref = $ord[$i];
$n = @$aref - 1;
NOSTOCK: for $j ( 0 .. $#nostock) {
$bref = $nostock[$j];
$n = @$bref - 1;
$comp = $aref->[4] cmp $bref->[0];
last NOSTOCK if $comp eq 0;
next NOSTOCK if $comp ne 0;
}
print 
"$aref->[0],$aref->[1],$aref->[2],$aref->[3],$aref->[4],$aref->[5],$aref->[6],$aref->[7],$aref->[8],$aref->[9]"
 
if $comp ne 0;
}
close(NOSTOCK);
close(ORD);
close(CUST);
######################

In what other ways (more efficient, faster or just different) can I 
complete this task?

Here are parts of my input files:
# custord2:
3,1000000005,R496055,348,PENFUZZY,11.99,1,04,25,00
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
3,1000000005,R496055,359,RANGREEN,8.95,1,04,25,00
# nostock.csv:
FNWDISPLAY,
HAVCASTLE,
HAVCONSTRUCTION,
HAVEASYFAMILY,
HAVMASTERCKDLX,
MERNEWBAKING,
MORHORSD,
RANGREEN,
RANONEFISH,
STRSMALL,
TLCELMOART,
TLCLITTLEBEAR,
TLCMADELINE,
WARLITTLEMEALS,

Thanks in advance.
Greg




---
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