Hi list,

I need help with my script, this supposedly would check a workstation listed 
in one file then see if it's not listed on other file, if it 's the case 
then append it on an output file.Basically what i got is the same unmodified 
list just appended on the output file. Where did i got  wrong? TIA.

#!/usr/bin/perl -w

use strict;
use Data::Dumper;

open(FL1,"pclist.txt") or die "can't open pclist.txt $!";
open(FL2,"smsclient.txt") or die "can't open smsclient.txt $!";
open(OUTPUT,">>unlisted.txt") or die "can't open pclist.txt $!";

my @smsclient = <FL1>;
my @pclist = <FL2>;
my %hash = map { $_ => 1 } @pclist;

foreach my $key (@smsclient) {
   chomp($key);
   unless(exists $hash{$key}){
   print OUTPUT $key,"\n";
    }
  }

 close(FL1);
 close(FL2);
 close(OUTPUT); 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to