Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
However, I don't really like the leading open brace "{" -- it looks naked to me. What approaches do Monks find best/most readable when wanting to create some scope? Here's some possibilities:my $BigCalc; { my $SmallCalc; .... $BigCalc = f($SmallCalc); } ... DoSomething($BigCalc);
#!/use/bin/perl use warnings; use strict; { my $x = 1; print "small calc $x\n"; } BLOCK: { my $x = 2; print "small calc $x\n"; } do { my $x = 3; print "small calc $x\n"; }; if (1) { my $x = 4; print "small calc $x\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Annotation of Anonymous Blocks
by moritz (Cardinal) on Sep 30, 2011 at 13:04 UTC | |
by Anonymous Monk on Sep 30, 2011 at 13:10 UTC | |
|
Re: Annotation of Anonymous Blocks
by roboticus (Chancellor) on Sep 30, 2011 at 13:13 UTC | |
by Anonymous Monk on Sep 30, 2011 at 17:12 UTC | |
|
Re: Annotation of Anonymous Blocks
by BrowserUk (Patriarch) on Sep 30, 2011 at 13:17 UTC | |
by Anonymous Monk on Sep 30, 2011 at 13:26 UTC | |
|
Re: Annotation of Anonymous Blocks
by Anonymous Monk on Sep 30, 2011 at 22:13 UTC | |
|
Re: Annotation of Anonymous Blocks
by Perlbotics (Archbishop) on Sep 30, 2011 at 21:19 UTC |