brian is a big, fat dumbass,'next' version

brian_d_foy on 2007-01-04T07:17:39

It's not even a week into 2007 and I'm already a big dumbass. I have a little utility that cleans up a bunch of text files from the command line, and like a good little program it saves the original in a backup.

foreach my $file ( @ARGV )
	{
	if( -d $file )
		{
		warn "Skipping directory [$file]!\n";
		}
		
	my $bak = "$file.bak";
	rename( $file, $bak );
	...
	}


I use this program and all of a sudden svn doesn't feel happy anymore because a lot of directories disappeared. Huh? I though I fixed this bug, and I'm pretty sure I did because I see the output "Skipping directory ...".

Well, let this be a lesson to you kids. You actually have to skip the directory to skip it. Perl doesn't have auto-next yet:

	if( -d $file )
		{
		warn "Skipping directory [$file]!\n";
		next;
		}