Cleaning up the warnings. (was Obfu spoiler: vladb's sig)by jarich (Curate)
|on May 29, 2002 at 05:03 UTC||Need Help??|
Line 9 prints $\, which, umm, defaults to nothing; here it looks like it's being treated as a newline, though, doesn't it? I've gotta admit: I'm not sure where $\ gets set to \n...
It looks like it's being treated as a newline... but $\ isn't being set to \n in this code. So when we execute this code it prints out the empty string. Perhaps vladb has typoed this, because the resulting print out is a little confusing without the newlines.
You'd notice the uninitialised values if you ran the code with warnings turned on:
If, of course, you can see them through the other mess of warnings. Why are we getting these hash assignment warnings? Well, we can isolate the code that's causing them, it's the ternary operator:
Perhaps Perl doesn't like blocks here? Or doesn't in my version of Perl (v5.6.1 built for i386-linux). We can't just remove them though, because if we do then we won't print out the file names that we delete.
I can't explain the error messages but I can give an alternate line that doesn't create them:
although of course your replacement is much neater. When we run our changed versions with warnings we get a slightly cleaner result:
And then any of the following lines can remove the remaining warning:
of course we could put the line $\=$/; somewhere before the for loop and then not even need this print$\; line at all.
With it all cleaned up it works quite nicely
Anyway, thanks for a great obfu spoiler, it's fun.