It's actually "if x { y }" in Perl rather than "if x then y".
This favours blocks of multiple expressions whereas "y if x" is good for a simple single expression.
A lot of the Perl branching and looping directives provide both methods so you can choose what you prefer.
Having both ways is great for the Perl one-liners :
cat file | perl -e 'while (<>) {next if /^SKIP /; print if /<fancy regex>/;}'
A lot of the Perl branching and looping directives provide both methods so you can choose what you prefer.
Having both ways is great for the Perl one-liners :