in reply to Re: simple Perl script template
in thread simple Perl script template

You may want to compare line 8 with line 1 and make appropriate changes....

... or use $^X.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^3: simple Perl script template
by hdb (Monsignor) on Apr 09, 2015 at 12:13 UTC

    Or just print the first two lines of the script itself in order to avoid inconsistencies:

    #!/usr/bin/env perl use Modern::Perl; seek DATA, 0, 0; my $header = join '', (<DATA>)[0..1]; for my $fname (@ARGV) { unless (-e $fname) { open my $fh, '>', $fname; print $fh $header; say STDOUT "created $fname"; } else { say STDOUT "*** didn't overwrite $fname"; } } __DATA__
      I like the idea of using the script actually copying from itself to the new script templates. This is DRYer. I have updated my local copy to this.