Re: reading input file, sorting then writing output file

2006-07-26 Thread Mumia W.
On 07/25/2006 08:32 PM, macromedia wrote: Hi, I can't seem to get my script to sort properly. [...] Here is a shortened version of your program: use strict; use warnings; use File::Slurp; my %tags; foreach my $line (read_file 'sort_tags.dat') { if ($line =~ m/id=(\d*)([[:alpha:]]*)/) {

Re: reading input file, sorting then writing output file

2006-07-26 Thread Mumia W.
On 07/25/2006 10:07 PM, Mumia W. wrote: On 07/25/2006 08:32 PM, macromedia wrote: Hi, I can't seem to get my script to sort properly. Below is my code [...] sort { $a->[0] cmp $b->[0] || $a->[7] <=> $b->[7] } [...] "Cmp" does string comparisons. Use "<=>" for numeric compar

Re: reading input file, sorting then writing output file

2006-07-26 Thread John W. Krahn
macromedia wrote: > Hi, Hello, > I can't seem to get my script to sort properly. Yes, it is a bit tricky to get right. > Below is my code along with > a sample input.txt file. I also have what the output.txt file should look > like. Also note any duplicate should be striped out > which seems t

Re: reading input file, sorting then writing output file

2006-07-25 Thread Mumia W.
On 07/25/2006 08:32 PM, macromedia wrote: Hi, I can't seem to get my script to sort properly. Below is my code [...] sort { $a->[0] cmp $b->[0] || $a->[7] <=> $b->[7] } [...] "Cmp" does string comparisons. Use "<=>" for numeric comparisons. Read "perldoc perlop". --

RE: reading input file, sorting then writing output file

2006-07-25 Thread macromedia
Opps. Once you save my code to a file the syntax woiuld be: perl mycode.pl input.txt output.txt Below is what I get now when I run my code on the input.txt file. As you can see its not sorting the way I like. It should sort like the OUTPUT.TXT file inmy previsou email. Test. Test.Test.Te

RE: reading input file, sorting then writing output file

2006-07-25 Thread macromedia
Hi, I can't seem to get my script to sort properly. Below is my code along with a sample input.txt file. I also have what the output.txt file should look like. Also note any duplicate should be striped out which seems to work ok. Something is getting messed up when I have the numerials along