in reply to Regex error when [] occurs in file..
$temp =~ s/#$'//;
I'm not even sure what you want that to do, but it constructs a regex out of # followed by whatever was followed by the previous match. Any regex special characters in that generated string will be interpreted as regex directives.
You probably want something like:
while (chomp(my $temp=<INPUT>)){ print Dumper $temp; $temp =~ s/#.*//; # remove comments if ($temp =~ /^\s*$/){ next; } print "after regex:\n"; print Dumper $temp; print "end\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Regex error when [] occurs in file..
by why_bird (Pilgrim) on Mar 03, 2008 at 16:03 UTC | |
by Joost (Canon) on Mar 03, 2008 at 16:11 UTC | |
by almut (Canon) on Mar 03, 2008 at 16:31 UTC |
In Section
Seekers of Perl Wisdom