tcf03 has asked for the wisdom of the Perl Monks concerning the following question:
I have two files
A contains multiple lines
userA, machine, last_logged_on userB, machine, last_logged_on
B contains multiple lines
UserA, password, location UserB, password, location
I want to open file A get the username
open (A, "FileA") || die "$!\n"; open (B, "FileB") || die "$!\n"; while (my @FILEA=<A>) { foreach my $line(@FILEA){ my ($nameA, $machine, $laston)=split(/,/,$line);
Here is where I want to have FileB opened and check $nameA against $nameB and if the match, do some stuff...
foreach my $lineb(@FILEB){ my ($NameB, $password, $location)=split(/,/,$lineb); if ( $nameA = $nameB ) { print "$nameA, $machine, $password\n"; }
It just doesnt seem to work like this...
Janitored by davido to clean up formatting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: searching two files
by ikegami (Patriarch) on Dec 22, 2004 at 21:19 UTC | |
|
Re: searching two files
by gopalr (Priest) on Dec 28, 2004 at 11:17 UTC |