Search notes:

Perl function: grep

grep can be used to filter elements in a list that meet a certain condition. It's probably the closest equivalent to Python's filter function.
#!/usr/bin/perl

use warnings;
use strict;

my @l = (
  'foo bar baz',
  'one two three',
  '123 456 789 0',
  'ding dong',
  'twenty-two: 42'
);

#
# Use a regular expression to filter the
# elements that have at least a numerical
# character:
#
my @grepped = grep {$_ =~ /\d/} @l;

print join "\n", @grepped;
#
# 123 456 789 0
# twenty-two: 42
Github repository about-perl, path: /functions/grep.pl

See also

Perl functions
grep (shell command)
The R function grep
Common first class function: filter

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1738292148, '18.189.186.5', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/functions/grep(73): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78