[Chicago-talk] working with a revolving number

Steven Lembark lembark at wrkhors.com
Wed Mar 10 23:11:10 CST 2004


> 1) this presents a problem.
> 2) I have to move the files to a new filename based on this order.
> 3) how would you go about coding for the anomaly (when B comes before A)
> since the max # could be 999.
>
> This is the code I use currently (I fix the anomaly by hand when I get an
> error via email)

Why not start by sorting the files then assigning
numbers to them? That way you can put them in any
order you like:

	my @filz = sort \&however_you_like @list;
	my @numbered = ();

	for( my $i = '000' ; @filz ; ++$i )
	{
		push @numbered, shift @filz . $i;
	}

(or something like it) will number your files after they
are sorted.


--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list