Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: use Drugs;

by Dylan (Monk)
on Sep 01, 2002 at 22:23 UTC ( [id://194481]=note: print w/replies, xml ) Need Help??


in reply to Re: use Drugs;
in thread use Drugs;

hrm, I hadn't thought of its strictness.
Thanks for the improvments!

As for it being C-like, that is very strange. Perl is my first (programming) language and I just started looking at C... I also really like map {} (and grep {}), but I thought for() was faster than map for some reason.

Replies are listed 'Best First'.
Re^3: use Drugs;
by Aristotle (Chancellor) on Sep 02, 2002 at 00:28 UTC

    It can be. That very much depends on what you're trying to do. Note I didn't pick map for efficiency here, more because it pulls the code together with fewer temporary variables at least using my overall style (and fewer of those do tend to lead to more efficiency).

    Selectively modifying elements of an array inplace, esp when you only need to touch few, most likely is best left to a for loop. Touching each or almost each and every element it can be a toss-up. When you are building a new array as you iterate over another, map is very likely the clear winner.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found