[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] This far...



Strider <Strider@baka.com> writes:
}I've gotten this far, and the file does an iterated walk, finds and adds up
}the file sizes. The problem, probably a stupid one, is that it's not
}iterating. What am I doing wrong?
}
}$dir = "Strider:Downloads";
}chdir $dir || die "Can't chdir $dir : $!";
}&readDir( $dir );
}
}sub readDir (){
}	local($path) = $_;
                       ^^^
Mistake.  The arguments get passed through the @_ array, not the $_ scalar.
Make this either:

	my ($path) = @_;

or
	my $path = $_[0];

(You also ought to get into the habit of "my" or "local" such things as $i,
$fil, @fileList, etc., in subroutines, just so you don't accidentally have
name conflicts in the future.)

}	opendir( DIR, $path ) || die "Can't open $path : $!";
}	@fileList = readdir( DIR );
}	closedir( DIR );
}
}	while ($i++ <= $#fileList) {
}		$fil = "$path:$fileList[$i]";
}		print "$fil $info[2]\n";
}		@info = stat($fil);
}		if ($info[2] =~ /16/) { &readDir( $fil );}
}		elsif ($info[2] =~ /33/) {$total += $info[7];}
}		elsif ($info[2] =~ /33/) {$total += $info[7];}
}	}
}}
}print "$total\n";
}
}-Seraph
}PS- thanks to all who helped me get this far =)
}
}
}


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch