develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Empty regex

Thread Previous | Thread Next
June 18, 2008 21:55
Re: Empty regex
Message ID:
> It's easy to generate a warning for such code, whether it is a good
> idea to do so is a different matter entirely.

Why wouldn't it be a good idea? I've just been burned. I'm sure a hell of
a lot of others have too. Seeing as MJD created that RFC in 2000 shows
even he might have been burned.

Can somebody show me when current behavior of /$empty/ would *ever* be a
good idea? I just don't get it. if I do:

  if ( $string =~ /$possible_empty/ ) {

when $possible_empty *is* empty, I *want* to test as empty, meaning *do
exactly* the same as split //. I don't understand why split() has this
only exception... if it was a good idea at the time for split, why not for

Sorry for my tone. I'm just a bit depressed that I fell into the booby
trap :)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About