[Chicago-talk] working with a revolving number

Dooley, Michael Dooley.Michael at con-way.com
Thu Mar 11 08:16:09 CST 2004

these files are generated by our EDI software. unfortunately I can not
control the sequence or order of the files.

for every A file there is an associated B file. I can have multiple A and B
files. so it really falls down to the edi software generated sequence and
98% of the time I have no errors in the process.

this makes sense when I wrote it so if I can clarify it anyway let me know.

-----Original Message-----
From: chicago-talk-bounces at mail.pm.org
[mailto:chicago-talk-bounces at mail.pm.org] On Behalf Of Steven Lembark
Sent: Wednesday, March 10, 2004 11:11 PM
To: Chicago.pm chatter
Subject: Re: [Chicago-talk] working with a revolving number

> 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
Chicago-talk mailing list
Chicago-talk at mail.pm.org

More information about the Chicago-talk mailing list