http://www.perlmonks.org?node_id=151272


in reply to How do I change the shebang line for all perl scripts in a directory

A quick (untested) hack:
#!/usr/bin/perl -w use strict; my @files = `find . -name "*.pl"`; foreach my $file (@files) { local*FH; open(FH, ">$file"); my @contents = <FH>; $contents[0]="#!/usr/local/bin/perl -w"; print FH $_ foreach (@contents); close FH; }

Yup, I'm aware of the bad practice in this script, however, its just a quick hack.

NB: I've taken the liberty to add warnings (-w) to your shebang, and it may break your scripts, although, it shouldnt.. :-)

Update: Fixed typo as per defyance's comment. Please note the "untested" disclaimer.