#! /usr/bin/perl use warnings; use strict; use Getopt::Long; my ($filterPassword, $filterIp, $file, $file2); my $help = 0; # z.B. program.pl -p password -i 127.0.0.1 -file datei.txt # oder: program.pl -h GetOptions(   "password=s"     => \$filterPassword,   "ip=s"           => \$filterIp,   "file=s"         => \$file,   "file2=s"        => \$file2,   "h"              => \$help, ); if ($help) { # &PrintHelp....   exit 1; } # if # vielleicht hier noch ueberpruefen, ob $filterPassword und $filterIp gesetzt sind.... unless (open (LOG, "<", $file)) {   die "Error: couldn't open '$file': $!\n"; } # unless my %filteredLines; while () {   chomp($_);   my (undef, $pass, $ip) = split(/ /, $_);   if ($pass eq $filterPassword and $ip eq $filterIp) {     push(@{$filteredLines{$ip}},$_);   } # if } # while close (LOG); {   local $/ = "\n===";   open(FILE2,"<$file2") or die $!;   while(){     next unless($_ =~ m/ip/s);     my ($ip)   = $_ =~ m/ip\s*?:\s+([^\s]+)/s;     my ($pass) = $_ =~ m/password\s*?:\s+([^\s]+)/s;     if ($pass eq $filterPassword and $ip eq $filterIp) {       if($filteredLines{$ip}){         print $_,"\n" for(@{$filteredLines{$ip}});       }     } # if   } } close FILE2;