in reply to sort after split

you get the empty parens because the array is empty. why do you try to chomp the array? chomp $entry instead, as the first line of the loop.
the hardest line to type correctly is: stty erase ^H

Replies are listed 'Best First'.
Re^2: sort after split
by lakeTrout (Scribe) on Dec 05, 2007 at 22:48 UTC
    Thanks Aquarium,

    I tried chomping then entry, but my list still prints in a sequential manner. Losing my mind :)
    open (DB1,"logfile.log") or die("There was a problem opening the file. +"); while ($entry=<DB1>) { chomp $entry; @fields = sort { $a cmp $b } split /\t/, $entry; #@fields=split(/ /,$entry); #chomp @fields; foreach $entry (@fields){ $_ =~ s/\n/\,/; }

    Any other ideas? I really appreicate your help all. Thank a Million.

    lT

      You seem to have missed (or deliberately ignored?) the question asked by Roy Johnson above. I'm sure that he won't object if I repeat his post in its entirety:

      What does your data look like? Give a few sample lines of input, and what you would want the output to be from that.