Hi y'all, I have a little script that lets me test some regexes. For example at the prompt I type in: "\b(The|the)\b". I thought it would be better if I could also include the slashes and then modifiers such as 'g' and 'i': "/\bthe\b/i" (for example).
So I modified it as below: ----------- my ($count, $linenumber) = 0; print "Enter regex (/regex/ ): "; chomp (my $regex = <STDIN>); while (<>) { chomp; $linenumber++; if ($regex) { print "\033[32mLine $linenumber: \033[2;37m$`\033[00m«\033[1;33m$&\033[00m\033[00m»\033[2;37m$'\033[00m\n"; $count++ } } print "Matches found: $count\n"; ----------- BUT it doesn't work. I get the "use of uninitialized value in concatenation or string..." error for each line and an empty search result «». The old code was simply "if (/$regex/)..." and that works fine. But if I take the slashes out and then type them in on the command line with the rest of the regex it fails. -Kevin -- Kevin Pfeiffer <[EMAIL PROTECTED]> - www.iu-bremen.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]