5 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl
use strict;
use warnings;
use Tie::File;
my $file_one = 'Datei1.txt';
my $file_two = 'Datei2.txt';
open my $fh, '<', $file_one or die $!;
tie my @lines, 'Tie::File', $file_two or die $!;
while( my $line = <$fh> ){
chomp $line;
my @words = $line =~ /\b([A-Z].*?)\b/g;
for my $word ( @words ){
unless( check( $word, @lines ) ){
push @lines, $line;
}
}
}
untie @lines;
close $fh;
sub check{
my ($value) = shift;
for my $line ( @_){
return 1 if $line =~ /\Q$value\E/;
}
return;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!/usr/bin/perl use strict; use warnings; use Tie::File; my $file_one = 'Datei1.txt'; my $file_two = 'Datei2.txt'; open my $fh, '<', $file_one or die $!; tie my @lines, 'Tie::File', $file_two or die $!; while( my $line = <$fh> ){ chomp $line; my @words = $line =~ /\b([A-Z].*?)\b/g; my ($verb) = $line =~ /\b([a-z]+t)\b/; for my $word ( @words ){ unless( check( $word, $verb, @lines ) ){ push @lines, $line; } } } untie @lines; close $fh; sub check{ my ($value) = shift; my ($verb) = shift; for my $line ( @_){ if( $line =~ /\Q$value\E/ and $line =~ /\Q$verb\E/ ){ return 1; } } return; }
5 Einträge, 1 Seite |