in reply to Use of uninitialized value in concatenation
The minimum the regex can match is a $ because the second capture is optional. If there are no \w characters following a $ character then the second capture will be undef and you get the warning. There are two ways you can fix it depending on the desired result. Using
(\$(\w+))
prints '$Word $' for the sample line, and
(\$(\w*))
prints '$Word dollar'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use of uninitialized value in concatenation
by gem555 (Acolyte) on Jun 11, 2009 at 05:42 UTC | |
by AnomalousMonk (Archbishop) on Jun 11, 2009 at 06:00 UTC | |
by gem555 (Acolyte) on Jun 11, 2009 at 06:18 UTC | |
by AnomalousMonk (Archbishop) on Jun 11, 2009 at 06:24 UTC |