This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update perlop.pod
author積丹尼 Dan Jacobson <jidanni@jidanni.org>
Sun, 1 Oct 2023 07:45:24 +0000 (02:45 -0500)
committerJames E Keenan <jkeenan@cpan.org>
Mon, 2 Oct 2023 12:10:19 +0000 (08:10 -0400)
Elsewhere in the page we see
> The bottom line is that using "/o" is almost never a good idea.

So I'll get rid of /o here too.

P.S., I also get rid of a newline, based on
```
$ echo 'while(<>){}if 0;'|perltidy
while (<>) { }
if 0;
```

pod/perlop.pod

index 8366ae3..1221fe9 100644 (file)
@@ -2106,9 +2106,8 @@ Examples:
  # poor man's grep
  $arg = shift;
  while (<>) {
-    print if /$arg/o; # compile only once (no longer needed!)
+    print if /$arg/;
  }
-
  if (($F1, $F2, $Etc) = ($foo =~ /^(\S+)\s+(\S+)\s*(.*)/))
 
 This last example splits C<$foo> into the first two words and the