I wrote this script because I just wanted to automate typing two lines of Perl every time I wrote a small test-case script.
This is dead simple and doesn't really count as 'cool'. However, in the words of the Greek poet Callimachus and E.F. Shumacher, "small is beautiful".
The script simply prints its own top two lines into every new file specified on the command line, unless the file already exists.
Any and all feedback will be welcomed.
#!/usr/bin/env perl
use Modern::Perl;
while (<@ARGV>) {
my $fname = $_;
unless (-e $fname) {
open my $fh, '>', $fname;
say $fh "#!/usr/bin/env perl";
say $fh "use Modern::Perl;\n\n";
say STDOUT "created $fname";
}
else {
say STDOUT "*** didn't overwrite $fname";
}
}