Perl script to fill out redirections