ARRAY = grep BLOCK LIST
examples/advanced/grep_perl.pl
#!/usr/bin/perl
use strict;
use warnings;

my @numbers = qw(8 2 5 3 1 7);
my @big_numbers = grep {$_ >= 5} @numbers;
print "@big_numbers\n";      # (8, 5, 7)
examples/advanced/grep_files.pl
#!/usr/bin/perl
use strict;
use warnings;

my @files = glob "*.xml";
my @old_files = grep { -M $_ > 365 } @files;
print join "\n", @old_files;
examples/advanced/unix_grep.pl
#!/usr/bin/perl
use strict;
use warnings;

my $regex = shift;
print grep { $_ =~ /$regex/ } <>;