happy-barney

Lexing perl - regular expressions and /e

Nov 26th, 2020
739
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. my $foo = 'foo';
  2.  
  3. # OK
  4. $foo =~ s{o}{{ 1 }}e;
  5. $foo =~ s{1}{{
  6.     2
  7.     # aaa bbb
  8. }}e;
  9.  
  10. # Failure
  11. $foo =~ s{o}{{ "}" }}e;
  12. $foo =~ s{o}{{ 1 # aaa bbb }}e;
  13. $foo =~ s{o}{{
  14.     1
  15.     # aaa } bbb
  16. }}e;
  17. $foo =~ s{o}{{
  18.     1
  19.     # aaa { bbb
  20. }}e;
  21.  
  22.  
RAW Paste Data