use CGI; $C = CGI->new(); $temp_user = $C->path_info(); $user = ""; # for taint checking if ($temp_user =~ /^\/(\w+)/) { $user = $1; } # do something with $user here # which if called as /user/jack will be "jack"