Eri Mendez wrote:
> 
> hi all,

Hello,

> 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 ( 0 .. $#input ) {
    print "\t[$_] $input[$_]\n";
}



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to