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

/(??{ "(?{ })" })/

From:
Abigail
Date:
August 5, 2008 15:12
Subject:
/(??{ "(?{ })" })/
Message ID:
20080805221151.GB11757@almanda
I wanted to make a dynamic regexp, and in the dynamic part, I want              
to eval some code.

So, I tried (condensed down to a small example):

    $ perl -wE '"" =~ /(??{ "(?{ })" })/'
    Eval-group not allowed at runtime, use re 'eval' in regex m/(?{ })/ at -e   
+line 1.


A run-time error, as it should. So, let's try again with re 'eval':            

    $ perl -Mre=eval -wE '"" =~ /(??{ "(?{ })" })/'
    Eval-group not allowed at runtime, use re 'eval' in regex m/(?{ })/ at -e  
+line 1.



Now, that I didn't expect.


Is this a bug? Or am I doing something wrong?



Abigail




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