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

Re: [perl #75812] kill $1 broken in 5.12.1

Thread Previous | Thread Next
From:
Abigail
Date:
June 18, 2010 04:38
Subject:
Re: [perl #75812] kill $1 broken in 5.12.1
Message ID:
20100618113915.GH10981@almanda
On Thu, Jun 17, 2010 at 10:26:13PM +0000, Ævar Arnfjörð Bjarmason wrote:
> On Thu, Jun 17, 2010 at 20:34, Todd Rinaldo <toddr@cpanel.net> wrote:
> > Any idea why use 5.12.1 makes it so kill $1 doesn't break?
> >
> > use 5.12.1;
> > my $pid = "12345  ";
> > if($pid =~ m/(\d+)/) {
> >        kill 9, $1;
> > }
> 
> I didn't check, but maybe due to the action at a distance regex
> matches in feature.pm? They use ([0-9]+), not (\d+) b.t.w., not sure
> if that matters.


I would assume they want a numeric value. In which case, using \d is
wrong, as \d matches several hundreds of different characters - and only
10 of them are considered numerical by perl.


(If we ever want a warning on existing behaviour, I vote to warn on any
 use if \d. Most of the time, the author intends [0-9], which hasn't been
 equivalent to \d for quite some time).


Abigail

Thread Previous | 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