in reply to Re: General Question: File triggered job launcher
in thread General Question: File triggered job launcher

I'd have to say that while your code logic is sound, I probably would opt for using File::Find instead of this sort of hand-coded solution. The reason for this is that your code is fairly sensitive to changes in the file structure and expected layout - It doesn't allow for the likelihood of other sub-directories within your directories (and is trying to open them as files), ignores files which may start with a period (grep(!/^\./, readdir(DIRHANDLE))) and while, probably more beyond the scope of the problem, doesn't check file permissions before trying to access the file.

These are all small(-ish) things I know, but if you take this code and extend it into a recursive search of directories, you could end up with some very nasty results with directory cross-links (especially to higher level directories). This is where widely tested modules offer the greatest advantage whereby you can to a certain extent rely on the testing and ground-work provided by others.

Just a few random thoughts that this code provoked

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'