Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: File::Find considered hard?

by crabbdean (Pilgrim)
on Mar 14, 2004 at 21:37 UTC ( #336539=note: print w/replies, xml ) Need Help??

in reply to File::Find considered hard?

I think the reason people have problems with map {code} array is two fold.

One: Usually a programmer will learn "foreach" commands first, and then stick to what they know.
Two: its a matter of linguistics - programming in itself is based/modelled on the mental conventions of the natural human thought process. Linguistically we are more likely to say and think "for each item in this array do blah blah" rather than "map this code to each element of this array". Its just a human tendency. (my honest opinion).

UPDATE: Just curious, which way is faster?

After some experience now with the File::Find module ... hmm .. my comments ... Its frought with danger and not a "clean" piece of programming. It also took me a while to get use to the idea of how it was to be used. I avoid it now and prefer using my own code. Oh, and that it crashed one of our servers because of its memory leaking "features". Personally I think its needs to be rewritten, considering directory traversing is a such common task.

The Funkster of Mirth
Programming these days takes more than a lone avenger with a compiler. - sam
RFC1149: A Standard for the Transmission of IP Datagrams on Avian Carriers

Replies are listed 'Best First'.
Re: Re: File::Find considered hard?
by zakzebrowski (Curate) on Mar 19, 2004 at 12:25 UTC

    With respect to your foreach comment, I agree competely. For each element do this just makes sense, and, the idiom is present in other languages as well. (IE. Java (shudder), VB (shudder), Basic (shudder), C, C++) Also, if you think in sql, a foreach statement is similar concept to doing a combinded sql statement. (Eg. Select example from table where item in (select item from other_table where item_status == 'not_processed')).

    Regarding speed comparisons, this has been discussed before.


    Zak - the office

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://336539]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-04-20 15:45 GMT
Find Nodes?
    Voting Booth?