#!/usr/bin/perl # find biggest file under current directory, or under # list of directories if arguments are given. require 'find.pl'; @ARGV = ('.') unless @ARGV; $maxsize = -1; find(@ARGV); $pretty = commify($maxsize); print "Biggest file in @ARGV: $bigfile has $pretty bytes\n"; exit; ##################################### sub wanted { my $size = -s $name; if ($size > $maxsize) { $maxsize = $size; $bigfile = $name; } } sub commify { local($_) = shift; while (s/^(-?\d+)(\d{3})/$1,$2/) { # kinda do not much for a while, just recalc # starting position } return $_; }