develooper Front page | perl.perl5.porters | Postings from August 2011

Re: [perl #97958] reset("") does not match docs

Thread Previous
Rafael Garcia-Suarez
August 29, 2011 00:11
Re: [perl #97958] reset("") does not match docs
Message ID:
On 28 August 2011 21:49, Father Chrysostomos <> wrote:
> $ perl5.14.0 -Xle 'for(1,2) { print "a" =~ ?a? }'
> 1
> $ perl5.14.0 -Xle 'for(1,2) { print "a" =~ ?a?; reset "" }'
> 1
> 1
> The documentation for reset() says that it resets ?? matches if there is no
> argument.  It says nothing about an empty string.  If anyone is using
> reset($string), and if $string is computer-generated, this could cause nasty
> surprises.
> Even though it’s generally better to make docs conform to longstanding
> behaviour, too strict a stand would prevent any bugs from being fixed.  And
> this one really does look like a bug to me.

My understanding of the docs is that reset *always* resets the ?? matches,
and also any package variable beginning with the given list of characters.
So the current behaviour matches the docs.

On a related note, maybe it's time to deprecate arguments to reset ?

It is always possible to aglutenate multiple separate problems into a single
complex interdependent solution. In most cases this is a bad idea.
    -- RFC 1925

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