Skip to content

Commit ed250f0

Browse files
committed
perlop: Change 'if(' to 'if ('
It is more customary to separate an 'if' from its paren.
1 parent a1dff12 commit ed250f0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pod/perlop.pod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ at all if the short-circuiting means that it's not required for any
7979
comparisons.) This matters if the computation of an interior argument
8080
is expensive or non-deterministic. For example,
8181

82-
if($x < expensive_sub() <= $z) { ...
82+
if ($x < expensive_sub() <= $z) { ...
8383

8484
is not entirely like
8585

86-
if($x < expensive_sub() && expensive_sub() <= $z) { ...
86+
if ($x < expensive_sub() && expensive_sub() <= $z) { ...
8787

8888
but instead closer to
8989

9090
my $tmp = expensive_sub();
91-
if($x < $tmp && $tmp <= $z) { ...
91+
if ($x < $tmp && $tmp <= $z) { ...
9292

9393
in that the subroutine is only called once. However, it's not exactly
9494
like this latter code either, because the chained comparison doesn't
@@ -547,10 +547,10 @@ not derive from the class given by the right argument, the operator evaluates
547547
as false. The right argument may give the class either as a bareword or a
548548
scalar expression that yields a string class name:
549549

550-
if( $obj isa Some::Class ) { ... }
550+
if ( $obj isa Some::Class ) { ... }
551551

552-
if( $obj isa "Different::Class" ) { ... }
553-
if( $obj isa $name_of_class ) { ... }
552+
if ( $obj isa "Different::Class" ) { ... }
553+
if ( $obj isa $name_of_class ) { ... }
554554

555555
This feature is available from Perl 5.31.6 onwards when enabled by
556556
C<use feature 'isa'>. This feature is enabled automatically by a
@@ -1591,7 +1591,7 @@ is the same as
15911591

15921592
Note, however, that this does not always work for quoting Perl code:
15931593

1594-
$s = q{ if($x eq "}") ... }; # WRONG
1594+
$s = q{ if ($x eq "}") ... }; # WRONG
15951595

15961596
is a syntax error. The C<L<Text::Balanced>> module (standard as of v5.8,
15971597
and from CPAN before then) is able to do this properly.

0 commit comments

Comments
 (0)