in reply to Re: Problem with reading multi-line
in thread Problem with reading multi-line
my $maskPrompt = "\r" . ' ' x (length($prompt) + 2) . "\r";
Why do you create this variable if you never use it?
my (@input) = (); print $prompt; chomp @input;
Why do you assign nothing to an already empty variable? And why then do you chomp an empty variable?
foreach $times(1 .. $times) { $ascii .= chr (<STDIN>); }
Why are you using the same variable name for the loop creation and for the local variable? I have been using Perl for many many years and I have never seen anyone do this before and it is very confusing. It only works because the value stored in $times is local to the loop body but it is not something that you should do because it is very confusing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problem with reading multi-line
by sarshads (Novice) on May 03, 2010 at 20:53 UTC | |
by bobf (Monsignor) on May 04, 2010 at 02:56 UTC | |
by sarshads (Novice) on May 04, 2010 at 18:42 UTC |