A Perl 6 implementation of 'grep'

#!/usr/local/bin/pugs

my $foo;

while ($foo = =<>) {
  print $foo if $foo ~~ m:perl5/$pattern/;
}