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

Re: On bad habits

by TedPride (Priest)
on Jun 22, 2005 at 01:35 UTC ( #468886=note: print w/replies, xml ) Need Help??


in reply to On bad habits

Join and split are sexy, but I rarely use map. It doesn't offer that much in the way of speed difference vs for (which, btw, can be the same as foreach in Perl, only shorter to write), and it makes your code much more complicated to read. There's something so beautiful about being able to do:
@arr = qw/aaa aba abb bac efg/; tr/a/x/ for @arr; print join ' ', @arr;
perrin: What's the point of having $_ and @_ if you don't use them? I will agree that any reasonably large sub should define variables for the contents of @_, but it's just so much neater to do a series of regexes on $_ than on a variable. I use it as much as possible.

Replies are listed 'Best First'.
Re^2: On bad habits
by perrin (Chancellor) on Jul 25, 2005 at 03:38 UTC
    What makes you think that everything in Perl needs to be used? I doubt anyone would claim that all of the ideas in Perl worked out equally well. Some are almost totally unused at this point.

    Perl lets you choose what to optimize for. I choose to optimize for readability.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2021-10-23 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (88 votes). Check out past polls.

    Notices?