in reply to How can I run only a determined part of script not using if/then statements

'==' is a numeric comparison. You want 'eq' for text.

Change
if ($func == "vi")
for
if ($func eq "vi")
and you are set.

also you should check out perlop

UPDATE: PLEASE follow busunsl's suggestions I would also suggest Ovid's CGI Course it addresses many security concerns.

grep
grep> cd pub grep> more beer