First, you never specify in your code against what you're matching, and you never give a value to $_ (the variable against which matching is done by default). I can't fathom what the line giving the error is trying to do (matching against any of the variables in the snippet woulnd't make sense), so we don't know how to fix this.
Second, my $fields = (); is the same as my $fields = undef;, and in the regular expression, you're refering to this variable instead of the first element of @fields as you probably intended. If you want to match what's in the first element of @fields, try: s/$fields[0]/$user/. Of course, that should probably really be: s/\Q$fields[0]\E/$user/ since @fields holds simple strings, not regexps.
In reply to Re: uninitialized value in substitution
by ikegami
in thread uninitialized value in substitution
by xjlittle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |