Shawn Wilson wrote: > ... my code > surely isn't written stout enough to handle a 'use strict'. if someone > could tell me what i am STILL doing wrong i'd appreciate it.
Hi Shawn, Please re-examine your operating precepts. By not using strict, you are passing up the best help you can get. If your coding practices can not stand up to the rigor of strict compilation, you will only dig yourself deeper by trying to move on without it. I would suggest scaling back first. Test your code in simple functions, and keep working at it until it compiles without error. The little tweaks that you get away with now are likely to come back to haunt you in the future. You will find yourself writing code that compiles just fine, but doesn't do what you expect it to. Worse yet, your code could work most of the time, only to fail at a critical point, where somebody else's data--your employers--is at stake. If you want to become a programmer, you will have to deal with the issues strict compilation raises. I'm looking at your code, and see it riddled with logic errors. For instance: if ($type ne 'bmp' or $type ne 'jpg' or $type ne 'png' or $type ne 'tif') { remove $file; } If the $type happens to be "bmp", do you know what will happen? It will fail the first test, since it is "bmp" since you are using or logic, it iwll be tested against the next condition, which it will pass. The file will be removed. The same will happen if $type is "jpg", "png", "tif", or "any_type_that_could_possibly_exist" The file will always be removed. Strict compilation would actually not catch this, although use warnings probably would. Using strict, though, would certainly help eliminate other errors that might obscure this logic error. The habits of intellectual rigor require to meet strict standards will certainly make them less likely to occur. Strict compilation is much more likely to cath something like this: unless ($file =~ /\.jpg\z/ or ...) { # delete every file exept listed image types. remove $file; } else { Right now, my mind is really swimming trying to sort out the meaning of this. Since else is the case where the condition is not met, it seems to me that you would be doing all those operations on the files you had just removed. The unless option is a twist on if. So is the else. Take a straightforward approach: if ($file =~ /\.jpg\z/ or ...) { handleFileAsImage($file, $dir); } else { remove $file; #presuming the file is in the local directory } Simplify your logic--and use strict. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]