OOPS :-( I wanted to sort the file that I am writing, by the second element in @DATA? Snip open CUST, $cust or die "Cant open it :$!"; open WRFILE, ">$wrfile";
while (defined ($line = <CUST>)) { chomp $line; @data = split(/\|/,$line); $newnum=$newnum+1; printf WRFILE ("0%9d",$newnum); print WRFILE ";", @data, ";"; print WRFILE "\n"; } -----Original Message----- From: David T-G [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 11:22 AM To: perl beginners Cc: Ned Cunningham Subject: Re: Printing all elements of an Array except the first? Ned -- ...and then Ned Cunningham said... % % Great, % Now how about sorting on the "new" first element of the array each time I % step through a file??? How about a little more detail? I'm not sure quite what you mean by new; you top-posted instead of providing any contextual reference. Given input of a b c d e f g h i a a a do you want to sort on the b/f/a elements, or something else? If you do, then - do you ever need the first elements, or can you just throw them away at read time and then sort naturally? - is there any reason not to whip up a little sort that's based on that element? In the last case, I envision something about like sort { $a[1] <=> $b[1] } or so... :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]