Your s/// is defaulting to use $_, which is not initialized. If I understand what you're trying to do, use $vhost =~ s/$fields[0]/$user/. Note that you shouldn't escape the brackets for the array index.
HTHIn reply to Re: uninitialized value in substitution
by bobf
in thread uninitialized value in substitution
by xjlittle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |