i am sure no "Permeister" so i hesitate to respond but here goes anyway;
it seems that you may be expecting too much of your while (<>) - unless
i'm wrong it does not automatically cycle the entire file every time.
(hopefully a real "Permeister" will correct me if wrong!)
if this is true an easy way to work it and maintain your logic is to
pull File B into another array and then go against that array rather
than the file itself.
also, i can't quote chapter & verse but there are other ways to do
almost exactly this in the Cookbook using hashes.
regards, bill
[EMAIL PROTECTED]
850.968.7764
-----Original Message-----
From: "Murillo; Lorenzo" [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 29, 2000 3:31 PM
To: "''[EMAIL PROTECTED]'"
Subject: Looping
Perlmeisters,
I have two files, File A contains user names (first, last names), File B
contains user names with password and email address.
A script is needed to extract the users in File B that exist in File A.
I wrote
the following script, but it stops after the first match.
I'm using Activestate Perl build 618. File B is piped in at the shell.
open(MARK, "marketing.csv");
@marketing = <MARK>;
close MARK;
foreach $user (@marketing) {
chop $user;
while (<>) {
if (m/^$user (.*)/) {
print $1;
}
}
}
Lorenzo Murillo
Systems Administrator
212 278 9379
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin