- or download this
#!/usr/bin/perl -w
use strict;
use Text::Balanced qw(extract_codeblock);
...
my ($e,$r) = extract_codeblock $_;
print "Code: $_\nExtracted: $e\nRemainder: $r\n\$\@: $@\n\n";
}
- or download this
Code: { $h{x} = "}" }
Extracted: { $h{x} = "}" }
Remainder:
...
Code: { $h{tr} = "}" }
Extracted:
Remainder: { $h{tr} = "}" }
- or download this
#!/usr/bin/perl -w -s
use strict;
use Parse::RecDescent;
...
$parser = Parse::RecDescent->new(q({my %foo} rule:"foo"{$foo{y}="}";})
+);
$parser = Parse::RecDescent->new(q({my %foo} rule:"foo"{$foo{m}="}";})
+);
$parser = Parse::RecDescent->new(q({my %foo} rule:"foo"{$foo{tr}="}";}
+));
- or download this
Parse::RecDescent: Treating "{my %foo}" as an action
Parse::RecDescent: Treating "rule:" as a rule declaration
Parse::RecDescent: Treating ""foo"" as an interpolated literal ter
+minal
...
Parse::RecDescent: Treating ""foo"" as an interpolated literal ter
+minal
printing code (3618) to RD_TRACE