Hello Carl and everybody. > Am 10.04.2004 4:03 Uhr schrieb Carl Miller (<[EMAIL PROTECTED]>): > MacPerl novice here, hoping someone can help me solve a problem. I'm running > MacPerl 5.6.1. > > ... ... ... > > So, to address this, I've added an -f test in the loop: > > foreach $FileName (@AllFiles) > { > > #if its a file, and not a directory, update it. > if (-f $FileName) { > > [.....do updates.....] > > }#end if file > }#end foreach > > ... ... ... > > Can anyone tell me what I'm missing? > > Thanks. >
As far as I can see your syntax is correct and SHOULD work (but then I don't understand why it *does not* work in the first and *does work* in the second case -- this is strange). But there is a common case on the Mac that can cause problems like yours. If the script tries to execute an invisible file (e.g. "ICON"), it may die. Suggestions: (1) Filter your files (... highly recommended): if (-f $FileName) { next if ($FileName =~ m/icon$/i); # don't forget the $-anchor # and the i-modifier [.....do updates.....] } In general, you should find some rule(s) that only matches the file you want to process, and that excludes files you want to ignore. (You can also try to implement an "invisibility"-test, but that's more code and more complicated, so try to find an easy way.) (2) Is there any error-catching in your update-code (like ' update this file or die "Hey, there's an interesting error with file $FileName." ')? Regards Joerg Beyer [EMAIL PROTECTED]