Delete every file whose name ends in .bak:
#!/usr/bin/perl use warnings; use strict; use File::Find; find ( \&callback, "/") ; sub callback { unlink $_ if /\.bak$/; }