However, no matter what I try, I cant seem to get the print line to work the way I would like. When I use this:open(INF,"$Dir/log.txt") or dienice("Can't open logs: $! \n"); @stats = <INF>; close(INF); foreach $i (sort byrate @stats) { chomp($i); ($rate,$team,$comment,$gotdate) = split(/\|/,$i); print "$rate $team $comment\n"; print "<br>"; print "$ip $gotdate\n"; print "<br><br>"; } sub byrate { @a = split(/\|/,$a); @b = split(/\|/,$b); $b[0] <=> $a[0]; }
Can anyone help this newkid out ? Thanks.print "[$rate] [$team] $comment\n"; print "<br>"; print "$ip $gotdate\n"; print "<br><br>"; or this: print "($rate) ($team) $comment\n"; print "<br>"; print "$ip $gotdate\n"; print "<br><br>"; it prints out the list in the correct order, that is numerically with the highest rate on top, BUT after it prints the rows out, it then prints an equal amount of these: [][] [][] [][] or these ()() () () etc. I tried stripping spaces or newlines, tried using a if $i > 0 or if exists ($rate) with no success.
In reply to Sort ofa Print Problem by caciqueman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |