#! /usr/bin/perl -w # # Add the GPL to the top of a source file # the programmer's name is in the "copyright" subroutine. use strict; use File::Copy; use Getopt::Std; use vars qw($opt_h $opt_C $opt_s $opt_p); sub usage { print <; close INFILE; open OUTFILE, ">$_" or die "Can't write to $_: $!\n"; #---------the point at which to insert the GPL: my $point = 0; #---------skip the shebang line if it's there if ($lines[0] =~ m/^\#!/) { ++$point; } #---------insert the GPL at $point splice(@lines, $point, 0, ($GPL)); print OUTFILE @lines; }