As others have pointed out this is Perl's "statement modifier" idiom. Perl has many shorthand ways of achieving things and that is a large part of what gives Perl its power to be concise and clear.
consider the following:
my $filename = "$root/$path/$name"; open my $fileHandle, '<', $filename or die "Failed to open $filename: +$!"; print $fileHandle "$_: $results[$_]\n" for 1 .. $#results; print $fileHandle "Total: $results[0]\n";
which deflares a variable in the middle of a file open statement, uses the "or die" idiom to check the result of an open, uses a for loop taking a range as a statement modifier and uses string interpolation to construct a file name from components and to build the strings to be printed.
The result is concise, lucid and robust.
In reply to Re: Are there any other statements that are like return if...?
by GrandFather
in thread Are there any other statements that are like return if...?
by skrapasor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |