#! /usr/bin/perl use strict; use warnings; my $smiley_regex = qr{ ( # Capture the match >:\( | :\( | :\| | :drinking: ) }x; while ( my $line = ) { if ( $line =~ $smiley_regex ) { print "$. ", $1, "\n"; } } __DATA__ :-) >:( :o) :-/ :( :drinking: