my $html_file = basename($0); my $pl_file = $html_file; $pl_file =~ s!html$!pl!; open(my $new_pl_file, '>', $pl_file); print $new_pl_file q{#!/usr/bin/perl use strict; use warnings; use lib "C:/Documents and Settings/ME/My Documents/fantasy/files/perl/lib"; use RolePlaying::SpellList qw(print_spell_scroll); print_spell_scroll(} .join(',',@spell_list). q{);};