develooper Front page | perl.beginners | Postings from February 2009

Reading 2 array lists

Thread Next
From:
mritorto
Date:
February 18, 2009 16:05
Subject:
Reading 2 array lists
Message ID:
dcf6bb10-711e-4e33-9c28-4b153742c60d@u18g2000pro.googlegroups.com
guys

I am new to perl scripting.

I am trying to read 2 different txt files into 2 different arrays.

My goal is to have a script read them both and print out any
differences.


Here is the script - it only prints out some of the files that end in
a *.cer extentions but is miss the other info


###### perl script



#! ./perl
#compares directories on 2 servers
open (INPUT, "<atlasdirectorylisting.txt");
open (INPUT2, "<ISISdirectorylisting.txt");
open (OUTPUT,">compare.log");
@lines = <INPUT>;
@lines2 = <INPUT2>;

%lines = map {$_,1} @lines;
@difference = grep {!$lines {$_}} @lines2;
print "@difference\n";


print OUTPUT "@difference\n";



close (INPUT);
close (INPUT2);
close (OUTPUT);



####################contents of atlasdirectorylisting.txt####



.
..
3ACC91EF-E063-4C88-9728-71E222608D14.cer
AE72EA9F-93B1-4834-86CE-FD68E78FAB07.cer
CORPACTION_data.mdf
CORPACTION_log.ldf
distribution.LDF
distribution.MDF
DML_data.mdf
DML_Log.ldf
DTCC.mdf
DTCC_log.ldf
FEE.mdf
FEE_log.ldf
GPLUS_data.mdf
GPLUS_log.ldf
LAVA_Data.MDF
LAVA_Log.LDF
lumigent.mdf
lumigent_log.LDF
Mobetter_data.mdf
Mobetter_index1.ndf
Mobetter_log.ldf
MSSQL.1
MSSQL.2
ProdSupport.mdf
ProdSupport_log.ldf
Reference_Data.MDF
Reference_Log.LDF
Staging_Data.MDF
Staging_Log.LDF
Sumicastx_data.mdf
Sumicastx_log.ldf
test.mdf
test_log.ldf


####contents of ISISdirectorylisting.txt");




.
..
7FAEBFBC-60F4-478A-A907-02C3CD227FCF.cer
CORPACTION_data.mdf
CORPACTION_log.ldf
D6EB2208-44E8-4552-AE7F-D025DC0C944D.cer
distribution.LDF
distribution.MDF
DML_data.mdf
DML_Log.ldf
FEE.mdf
FEE_log.ldf
GPLUS_data.mdf
GPLUS_log.ldf
LAVA_Data.MDF
LAVA_Log.LDF
lumigent.mdf
lumigent_log.LDF
Mobetter_data.mdf
Mobetter_index1.ndf
Mobetter_log.ldf
ProdSupport.mdf
ProdSupport_log.ldf
Reference_Data.MDF
Reference_Log.LDF
Staging_Data.MDF
Staging_Log.LDF
Sumicastx_data.mdf
Sumicastx_log.ldf
test.mdf
test_log.ldf


####contents of compare (output) txt file



7FAEBFBC-60F4-478A-A907-02C3CD227FCF.cer
 D6EB2208-44E8-4552-AE7F-D025DC0C944D.cer



What am i missing?

marc


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About