Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Style, style, style

by rir (Vicar)
on Sep 09, 2002 at 01:48 UTC ( #196131=note: print w/replies, xml ) Need Help??


in reply to Style, style, style

I would use  while (<>) { ...} only because it has been
hammered into me as the idiom.
This is not an argument for the usage.

No no warnings; because I use 5.005.

use constant CONSTANT => "value"; is better for any code where
the difference might matter. For simple & well contained
code I have the bad habit of
 my $VAR = "value";     # XXX constant

Definitely my ($foo, $bar) = @_; this is crystal clear
and screen space is valuable. I do find that I don't use
my ($foo, $bar, @valuable) = @_; though.

Regarding for ( @array) versus foreach (@array) , I don't
care much. I use foreach for this and use for for C-style loops.
I'd nearly never use $_ here. I rarely use implicit $_
except for the most common idioms. Though I'm usually
using Perl I don't want to develop overly specialized finger
habits.

Always print 'foo'; I don't follow print statements with
more code on the same line.

Breaking the C habit of using qq quotes had some appeal.
Then I coded a lot of print statements. qq usage is more
flexible, save q for when you have to use it.

glob '*' or <*>
I would lean toward glob but I have not used either construct.

Again <FOO> is the standard idiom.

I find keys is the most natural way to go through a hash.

Log In?
Username:
Password:

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

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












    Results (62 votes). Check out past polls.

    Notices?