in reply to Building the structure to hold said beast.
in thread Nested loops in HTML::Template
Unfortunately, this is an untested piece as I have no 'good' means to thoroughly test it on the box I"m on now (my MS-DOS command prompt doesn't work for some freakn reason.. ). I'll do the testing on my Unix box at work (during coffee time, yeah! ;-)#!/usr/bin/perl use strict; use File::Find; use Data::Dumper; my $dir_list; # count of { file_row => [...] } entries inside # dir_row array. (err.. simply dir_row array's size). my $dir_row_count = 0; my $file_count = 0; # number of files in a row.. my $file_split_count = 5; # previous directory my $prev_dir; find(\&wanted, 'data'); print Dumper($dir_list); ### SUBS sub wanted { $DB::single = 1; unless ($prev_dir eq $File::Find::dir) { $prev_dir = $File::Find::dir; # got a new directory push @$dir_list, { dir => $File::Find::dir, dir_row => [] }; } if (-f $_) { unless ($file_count % $file_split_count) { # add another file row if maximum number of files # allowed in a row has been exceeded. push @{$dir_list->[scalar @$dir_list - 1]{dir_row}}, { file_row +=> [] }; } # add file to the file row... push @{$dir_list->[scalar @$dir_list - 1]{dir_row}[$dir_row_count] +{file_row}}, { filename => $File::Find::name }; $dir_row_count++; $file_count++; } }
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}
|
|---|