"Marco" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The input file only contains lines like:
>
> foo.com
>
> But the target file(s) look like this: (example specified is just an
example)
>
> zone "foo.com" {
> type master;
> file "pri/foo.com";
> };

    use strict;
    use warnings;

    @ARGV = qw (one.txt two.txt  three.txt);

    my %zone;

    while (<>) {
        if (/^zone\b/) {
            /"(.+)"/;
            push @{$zone{$1}}, $ARGV;
        }
    }

    @ARGV = 'zonelist.input';

    while (<>) {
        chomp;
        if (my @files = @{$zone{$_}}) {
            push @files, join ' and ', delete @files[-2,-1];
            print "Zone $_ was found in files ", join (', ', @files),
"\n";
        } else {
            print "Zone $_ was not found\n";
        }
    }

__END__

(Untested)

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to