R. Joseph Newton wrote:
> "...
> foreach(1..$total_elements){
> print "\t\[$_\] my $input[$_ - 1 ]\n";
> }
> ...Why did scalar $input in the foreach loop
> "works" without predeclaring it with my?" --Eri
>
> HI Eri,
>
> The my is probably not doing what you think it is. Otherwise
> it would
"...
foreach(1..$total_elements){
print "\t\[$_\] my $input[$_ - 1 ]\n";
}
...Why did scalar $input in the foreach loop
"works" without predeclaring it with my?" --Eri
HI Eri,
The my is probably not doing what you think it is. Otherwise it would constitute a
redeclaration error. My guess
Eri Mendz wrote:
>
> 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 "Plea
"Eri Mendz" <[EMAIL PROTECTED]> wrote in message
3E2D45F0.14555.14A0579@localhost">news:3E2D45F0.14555.14A0579@localhost...
> chomp(my @input = );
> my $total_elements = scalar(@input);
Assigning to a scalar variable puts the right-hand-side in scalar
context anyway.
my $total_elements = @in
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:\
Eri Mendez wrote:
> 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:
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;
>
> #
"print "\t\[", $_, "\] $_\n";"
Hi Eri,
I would suggest dispensing with the comma operators. They can have some rather
unexpected effects in this context. Remember--variables within full quotes are
interpolated before the string is taken. So you could write the above as:
print "\t\[$_
Eri Mendez wrote:
> 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: