Citeren Yitzchak Scott-Thoennes <sthoenna@efn.org>: > On Mon, June 2, 2008 1:52 pm, Bram wrote: >> Quoting David Nicol <davidnicol@gmail.com>: >>> Warn that non-final $ will interpolate in documentation and suggest >>> \Z instead? >> >> Given how easy it is to miss it I feel more for a >> 'Possible unintended interpolation of $\ in regex' warning. (if that >> is even possible of course) >> >> Any comments on the warning? > > Sounds great, if you can make it suppressable with ${\}. > Patch attached. ./perl -wle '"" =~ m/$\s/;' Possible unintended interpolation of $\ in regex at -e line 1. ./perl -Ilib -Mdiagnostics -wle '"" =~ m/$\s/;' Possible unintended interpolation of $\ in regex at -e line 1 (#1) (W ambiguous) You said something like m/$\/ in a regex. The regex m/foo$\s+bar/m translates to: match the word 'foo', the output record separartor (see perlvar/$\) and the letter 's' (one time or more) followed by the word 'bar'. If this is what you intended then you can silence the warning by using m/${\}/ (for example: m/foo${\}s+bar/). If instead you intended to match the word 'foo' at the end of the line followed by whitespace and the word 'bar' on the next line then you can use m/$(?)\/ (for example: m/foo$(?)\s+bar/). ./perl -wle '"" =~ m/${\}s/;' ./perl -Ilib -Mdiagnostics -wle '"" =~ m/${\}s/;' Not sure tho if the text in perldiag is clear enough... Kind regards, BramThread Previous | Thread Next