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

Empty regex

Thread Next
From:
alfie
Date:
June 18, 2008 20:47
Subject:
Empty regex
Message ID:
53781.59.167.195.42.1213847244.squirrel@www.share-house.com.au
Hi,

From http://dev.perl.org/perl6/rfc/144.html

-- 8< --

Any code that contains the innocent-looking

        if (/\Q$string\E/) {
          ...
        }

is potentially booby-trapped. Such code is common.

-- >8 --

Is there anyway to make /$string/ warn if $string is empty? Maybe even in
future releases of perl?

Alfie

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About