Dear All,

I'm greatly overwhelmed by your quick help to my problem. 
Here's the corrected code:

#!/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-Z:\n";
#im at work right now :-)
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\[$_\] my $input[$_ - 1 ]\n";
}

print "Press enter to see inputs in reverse order: ";
my $press = <STDIN>;
@input = reverse(@input);
print "The reverse -> @input \n";

Just a quickie. Why did scalar $input in the foreach loop 
"works" without predeclaring it with my? I tried running both 
and it runs as expected. No scoping required for this control 
variable?

Thanks a lot. It sure is nice to learn when there are helpful 
hands around. C yah.

-- 
Best wishes,
Eri Mendz [Windows XP Pro Version 2002]
This is perl, v5.8.0 built for MSWin32-x86-multi-thread


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

Reply via email to