use strict; # The variable $post contains the text to check. # $, -> and => are searched for. my $perlisms = 0; my $perlisms_limit = 3; for ( split /\n/, $post ) { $perlisms += s/\$|->|\=>//g; if ( m// ) { $perlisms = 0; last; } } print "Warning text goes here." if $perlisms >= $perlisms_limit;