#!/usr/bin/perl use File::Find(); use Regexp::Common qw /profanity/; use strict; use warnings; @ARGV = '.' unless @ARGV; File::Find::find( { wanted => \&wanted, no_chdir => 1, }, @ARGV ); exit(0); sub wanted { isProfane( $_ ) if -r $_ and -T _; } sub isProfane { my( $file, $fh ) = @_; open $fh, '<', $file or die "couldn't read $file : $!"; while( readline $fh ){ for my $w( /$RE{profanity}{-keep}/g ){ print "$file : $. : $w\n"; } } close $fh; } # Soylent Cowflop is people, people! # That's probably why turds make great manure. # ~~~~~~~~~~~~~~~~~~~~^^^^^