-p causes Perl to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed: LINE:while (<>) { # your program goes here } continue { print or die "-p destination: $!\n"; }