John W. Krahn wrote:
>> i run the perlscript with a file suffix like: >> ./perlscript test1.txt >> i am trying to reverse the contents of test1.txt line-by-line and print >> them out. but i dont get any output.any help would be appreciated. > > > print reverse <>; > And they say perl is hard! I once incorrectly replied to a post that wanted to: > >> </snip> sort arrays by > >> size. (The op) need(ed) to sort any number of given arrays, and > >> operate on the largest to the smallest. I misunderstood the problem and incorrectly replied with: > > $ perl -e 'print(sort({$a <=> $b} (7,3,4,9,5,6,1,8,2,)), "\n");' > > 123456789 but the solution is: > @x1 = ('a','b','c'); > @x2 = ('d','e'); > @x3 = ('f','g','h','i'); > > @s = sort {@$b <=> @$a} (\@x1,\@x2,\@x3); > print "@$_\n" for @s; > -------- > outputs: > f g h i > a b c > d e My point is that the algorythm is still as simple as sorting an array (once you understand references). I guess sorting the arrays would be just as easy as it would be in C after your sorting function is written, but try printing the reverse of a set of files in a single statement with it. Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]