#!/usr/bin/perl use strict; use warnings; unlink '/tmp/kids.txt'; open my $INPUT, '/tmp/femto_check_edited2.txt' or die $!; open my $IN, '/tmp/utrancell_edited2.txt' or die $!; my @list_match; while(<$INPUT>){ chomp; push @list_match, $_; } close $INPUT; open my $KIDS, '>', '/tmp/kids.txt' or die $!; while (my $line = <$IN>) { chomp $line; for my $num (10 .. 15) { if (grep(/$line-Femto_$num/, @list_match) == 1) { print "$line-Femto_$num\n"; } else { print "$line-Femto_$num er ikke definert\n"; print {$KIDS} " $line-Femto_$num er ikke definert\n"; } } } close $KIDS; close $IN;