Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: File::Find

by larryl (Scribe)
on Mar 14, 2001 at 01:13 UTC ( #64213=note: print w/replies, xml ) Need Help??

in reply to File::Find

I find myself using File::Find more and more now that I've got the hang of it. Typically you set up like so:

use File::Find; find( \&do_stuff, $from_dir );
and do_work() is the place where all the real work gets done.

A couple caveats that I've found (the hard way...) about what you can do inside do_work():

  • Don't change $_ inside do_work(). If you want to, save a copy on entry and change it back before returning.
  • As Corion mentions, the working directory is changed to each recursed directory under your starting point. If you change directories inside do_work(), save a copy of the current directory on entry and chdir back to it before returning.
  • The usual file test operator caveats apply, for example -f $File::Find::name and -l $File::Find::name are both true if the file is a symlink to another file. If you're interested in symbolic links, test for those first, before you test for file- or directory-ness.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://64213]
[ambrus]: (b) a good presentation system that lets the presenter quickly interactively edit the slides live during a presentation, to combine the advantages of blackboard and overhead slide styles in modern tech
[Corion]: Heh - in university, I cheated on (a) by doing blackboard presentations using chalk. But those were 2 hour presentations, not quick/essential/ reduced presentations where you want to show something quick
[ambrus]: (either on just one screen or two screens). this is necessary because
[ambrus]: overhead slide plus blackboard is inconvenient because the lighting conditions are different and they require separate areas you can't quickly repartition, and typing on keyboard is faster and more convenient than writing on a blackboard
[Corion]: (b) would be cool. I've thought about this doing Pod editing, and even simply regenerating/live updating the browser makes things much more interactive
[ambrus]: modern computers have way enough processing power to allow this, at least for geeks who are willing to spend a few weeks to learn a tricky new user interface like vim
[Corion]: ambrus: Well, for mathematical notation, I find blackboard much more convenient than a computer. But when inserting text or moving text around, the computer wins obviously
[ambrus]: But either of these is a big problem in practice, so I'd need to spend like thirty years of my life to solve (a) and five more years to solve (b)
[ambrus]: Corion: yes, CURRENTLY the blackboard is more convenient
[ambrus]: and it's not like I want to ban blackboards anyway

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2017-09-26 10:18 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.