in reply to Perlwanab grep array elemetns against another array

while (<SOURCE>) { $script = <SOURCE>;

This ignores every second line in 30.txt, because it reads one item from SOURCE and assigns it to $_, and then another one and assigns it to $script. If that's not what you want, write while (my $script = <SOURCE>) { ... } or so instead.

It might also help if you gave us a little example of a few inputs, and what output you expect from them.

Perl 6 - links to (nearly) everything that is Perl 6.