develooper Front page | perl.perl5.porters | Postings from March 2013

Do we expect $1 set after concatted regex match?

Thread Next
From:
H.Merijn Brand
Date:
March 20, 2013 10:56
Subject:
Do we expect $1 set after concatted regex match?
Message ID:
20130320115620.2fb0e8b4@pc09.procura.nl
$ perl -wE'"x".q{abc} =~ m/xab/ and say "OK"'
OK
$ perl -wE'"x".q{abc} =~ m/(xa)b/ and say "OK"'
OK
$ perl -wE'"x".q{abc} =~ m/(xa)b/ and say $1'
Use of uninitialized value $1 in say at -e line 1.

$ perl -wE'q{xabc} =~ m/xab/ and say "OK"'
OK
$ perl -wE'q{xabc} =~ m/(xa)b/ and say "OK"'
OK
$ perl -wE'q{xabc} =~ m/(xa)b/ and say $1'
xa


-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.17   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

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