hi all, another newbie here. im having problem how to print to stdout the string[s] entered by user and appending a subscript integer after that string. this is my modification to exercise 1 chapter 3 of Llama book:
#!/usr/bin/perl -w use strict; # filename: reverse_string.pl # editor: # VIM - Vi IMproved 6.1 # description: get user input and reverse input print "Please enter any string, to quit press Ctrl-D:\n"; chomp(my @input = <STDIN>); my $total_elements = scalar(@input); print "You have entered $total_elements arguments.\n"; print "They are: \n"; foreach(1..$total_elements){ print "\t\[", $_, "\] $_\n"; } #foreach(@input){ # print "\t\[", $_, "\] $_\n"; #} print "Press enter to see inputs in reverse order: "; chomp(my $press = <STDIN>); @input = reverse(@input); print "The reverse -> @input \n"; ##########<\result>########## Please enter any string, to quit press Ctrl-D: just another perl newbie ^D You have entered 4 arguments. They are: [1] 1 [2] 2 [3] 3 [4] 4 Press enter to see inputs in reverse order: The reverse -> newbie perl another just ##########<result>########## my target is print the strings after the subscripts. I tried several variations but cant get it right. if i uncomment the 2nd foreach block in place of first, i get the strings but again in dupes. grrrr, i feel im close to the solution. is split again needed here? just give me hint, not straight answer so i can pound my head to think. TIA. -- Regards, Eri Mendz Using Perl, v5.8.0 Linux 2.4.19-16mdk i686 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]