Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Style, style, style

by vek (Prior)
on Sep 08, 2002 at 16:07 UTC ( #196038=note: print w/replies, xml ) Need Help??


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 --

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://196038]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2021-06-22 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (105 votes). Check out past polls.

    Notices?