It is quite easy to write files from Perl, see open and print. Be sure to chmod (assuming UNIX). When calling the script using system or qx it is probably best to pass the full path name.
On the other hand, would it not be better to write it in Perl? Off hand I can't think of anything shell scripts can do (even the very latest versions) that Perl cannot.
Comment on Re: building and running a unix script with Perl
There's nothing shell scripts can do that cannot be done in Perl1. But there are things that are easier done in a shell script than in Perl. Sourcing other shell scripts for instance (and hence, getting access to environment variables). You can't really beat