tphyahoo has asked for the wisdom of the Perl Monks concerning the following question:
Works fine, but I don't like it. I don't like sometimes using " and sometimes ', I don't like all those prints, I just... yuck. Can someone point me towards a better way of solving this type of problem? I know about the template toolkit, and am considering learning that and using it as a solution. Any other ways for quicky throwaway scripts like this?use strict; use warnings; my @names = qw(file1 file2); for my $name (@names) { open OUTPUT, "> $name.ini"; print OUTPUT "[main]\n"; print OUTPUT "left_hand_side=$name.html\n"; print OUTPUT "right_hand_side=$name.php\n"; print OUTPUT 'file_regex_pattern=\.php$' . "\n"; print OUTPUT 'dir_regex_pattern=(?!^svn$)'; close OUTPUT; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is there a better way to automate file creation?
by rinceWind (Monsignor) on Sep 14, 2005 at 12:48 UTC | |
|
Re: Is there a better way to automate file creation?
by chester (Hermit) on Sep 14, 2005 at 12:49 UTC | |
by davidrw (Prior) on Sep 14, 2005 at 13:15 UTC | |
by philcrow (Priest) on Sep 14, 2005 at 13:50 UTC | |
|
Re: Is there a better way to automate file creation?
by samizdat (Vicar) on Sep 14, 2005 at 12:49 UTC |