On 2008.01.12 01:12:42 -0800, Eric Wong wrote: > Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Is it only me who finds that > > > > ($var) = ($var =~ m{^(any regexp)$}) or die "message" > > > > is extremely a roundabout and hard-to-read way to say: > > > > if ($var !~ m{^(the same regexp)$} { > > die "message"; > > } > > > > which is much easier to read? > > The statements are not equivalent, however. I'd have to add > > $var = $1; > > too, because I needed to extract what was inside the ( ) since the '$' > doesn't catch the trailing newline, either. I also couldn't find any of > the /sm, /m, /s switches useful for making '$' not accept the trailing > newline, either. The \z assertion will do, eg m/^foo\z/ will only match exactly "foo", not "foo\n". As it is a zero-width assertion, you can also write m/^foo\z$/ if you prefer that. Björn - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html