$basedir = $req->param("path");
Read
CGI.pm documentation about how to read data from a form.
WARNING: This is VERY dangerous! You should not have the option to enter a path in the form. If you do this, then you could end up losing data if someone types something bad in the form.
This also provides no error checking. I recommend use the -T switch and taint check your data or have a drop down box with numbers 1-10 and then have the $basedir variable set to something specific based on the number.