Programming Tips - Do I aways need the semicolon in Perl?

Date: 2010sep29 Language: perl Q. Do I aways need the semicolon in Perl? A. No. The semicolon is a separator so you only need it between statements. For example:
if ($is_something) { next; }
Can be replaced with:
if ($is_something) { next }
Since there isn't a statement after the 'next' in that block. (Even more compactly you can write this as:
next if $is_something;
But that's not the point here.) Another place you'll find needless semicolons is 'return' statements. Since by definition there is nothing after them. eg:
sub foo() { return 'hello'; }
Does not need the semicolon. Basically every semicolon before a close brace is unnecessary. If you keep this info in mind you can avoid quite a few semicolons in your Perl code and it a bit smaller.