"Use of unitialized valie in string ne at "
*Do* please get into the habit of copy/pasting the exact text of what
you are seeing. Re-typing it (badly) is no way to get help, and soon
you are going to find problems here.
Perl has a list of the diagnostic (error and warning) messages which
it issues itself (of which this is one), and you can look them up for
an explanation. The documentation comes with every Perl installation,
and there are also copies on the web.
perldoc perldiag
Conversely, I find that feeding an exact error message to a search
engine (e.g google) can often solve my own problems much faster than
posting to a usenet group, but mistyping the message pretty-much
guarantees very poor results from the search.
Is there a way how I can suppress these error messages.
You need to understand what you are seeing here. Perl is alerting you
to a potential problem, by means of a warning (not literally "error")
message.
So what do you really want to do? Make good use of Perl's help (which
is what I would recommend), or hide the problem away and hope for the
best?
The truth is that your program logic is faulty: you are trying to use
a variable to which you have not assigned a value. Perl is helpfully
alerting you to this. My advice is don't even think about suppressing
this valuable information: use it, work out what it's telling you.
Consider yourself lucky, that the failed match didn't leave some
unrelated value from a previous operation, which you would have used
without any warning. Correct your program logic so that you don't try
to use a match value when it hasn't been set.
If and when you're in a situation where you *really* want a variable
set to an empty value rather than being undefined, do what the
documentation says:
Use of uninitialized value%s
An undefined value was used as if it were already defined.
It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.
Which is a good answer, in appropriate situations. But that's not
what's needed here (regex match variables).
Anyone who advises turning warnings off to hide the warning may be
technically accurate about what Perl does or can do - but
operationally it's a disaster. The whole point of Perl's warnings and
strict pragmas are to help one find errors on one's code. Only in the
most extreme cases should it be necessary to turn these off briefly.
Consider all other possibilities first. That's my advice.