in reply to Style, style, style
1. while (<>) { ... } or while (my $line = <>) { ... }
while (<>)
2. -w or use warnings;
-w for portability
3. sub CONSTANT () { ... } or use constant CONSTANT => ...;
use constant CONSTANT => ...
4. my ($foo, $bar) = @_; or my $foo = shift; my $bar = shift;
my ($foo, $bar) = @_;
5. for (@array) { ... } or foreach (@array) { ... }
for (@array) { ... }
6. print 'foo'; or print('foo');
print 'foo'
7. 'simple string' or "simple string"
"simple string"
8. glob '*' or <*>
Ha ha, like dws I prefer - opendir(), readdir(), closedir()
9. readline *FOO or <FOO>
<FOO>
10. for (keys %foo) { $_ and $foo{$_} } or while (my ($key, $value) = each %foo) { $key and $value }
for (keys %foo) { $_ and $foo{$_} }
-- vek --
while (<>)
2. -w or use warnings;
-w for portability
3. sub CONSTANT () { ... } or use constant CONSTANT => ...;
use constant CONSTANT => ...
4. my ($foo, $bar) = @_; or my $foo = shift; my $bar = shift;
my ($foo, $bar) = @_;
5. for (@array) { ... } or foreach (@array) { ... }
for (@array) { ... }
6. print 'foo'; or print('foo');
print 'foo'
7. 'simple string' or "simple string"
"simple string"
8. glob '*' or <*>
Ha ha, like dws I prefer - opendir(), readdir(), closedir()
9. readline *FOO or <FOO>
<FOO>
10. for (keys %foo) { $_ and $foo{$_} } or while (my ($key, $value) = each %foo) { $key and $value }
for (keys %foo) { $_ and $foo{$_} }
-- vek --
|
---|
In Section
Meditations