This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta: Turn one-liner into a block of code
authorFather Chrysostomos <sprout@cpan.org>
Tue, 13 Dec 2011 22:40:20 +0000 (14:40 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 13 Dec 2011 22:41:07 +0000 (14:41 -0800)
so the line isn’t too long.

pod/perldelta.pod

index 63a2da6..2143cd9 100644 (file)
@@ -610,7 +610,12 @@ named captures that weren't matched as part of a regex ever since 5.10
 when they were introduced, e.g. this would consume over a hundred MB
 of memory:
 
-    perl -wle 'for (1..10_000_000) { if ("foo" =~ /(foo|(?<capture>bar))?/) { my $capture = $+{capture} } } system "ps -o rss $$"'
+    for (1..10_000_000) {
+       if ("foo" =~ /(foo|(?<capture>bar))?/) {
+           my $capture = $+{capture}
+       }
+    }
+    system "ps -o rss $$"'
 
 =item *