On 11/29/07, Marco <[EMAIL PROTECTED]> wrote:

> The code will show 2 line liek below, how can I get the a number "2"
> and save to the variable?  thanks.
>
> User: ABC
> User: DEF

It sounds as if you want to count each print operation. You can do
that if you set a variable to zero before you begin printing:

  my $lines = 0;

Then, each time you print a line, you add one to $lines.

  print "whatever\n";
  $lines++;  # add one to $lines

After you've finished printing, $lines will hold the value you need. Is that it?

Cheers!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to