Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: File::Find considered hard?

by crabbdean (Pilgrim)
on Mar 14, 2004 at 21:37 UTC ( [id://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.

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

    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.

    Cheers.


    ----
    Zak - the office

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-19 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found