in reply to guidelines for inline coding
you can also do things like this:$ perl -e 'my $i = 0; print $i++, " " while $i < 10;' 0 1 2 3 4 5 6 7 8 9 ~ $ perl -e 'my @array = 1..10; print 2*$_, " " for @array;' 2 4 6 8 10 12 14 16 18 20 ~
But you cannot do this:for (@array) { print $ERRORS "Error: value $_ is negative\n" and next if $_ < 0; push @valid_vals, $_; }
You can't use an other clause when if is used as a statement modifier (i.e. after the statement).5 statement if condition else other_statement;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: guidelines for inline coding
by Your Mother (Archbishop) on Sep 25, 2014 at 17:50 UTC | |
by Laurent_R (Canon) on Sep 25, 2014 at 21:41 UTC | |
by BrowserUk (Patriarch) on Sep 25, 2014 at 19:29 UTC | |
by Anonymous Monk on Sep 25, 2014 at 19:46 UTC | |
by BrowserUk (Patriarch) on Sep 25, 2014 at 20:56 UTC | |
by Anonymous Monk on Sep 25, 2014 at 21:12 UTC | |
|