Sara wrote:
> Why the length is not coming out? Any ideas?
> 
> #################################################
> 
> my @aho = ("fgfgfgf", "fgfgfgfgf", "fgfgfgfg");
> 
> my $length += length($_) for @aho;

A perl "gotcha". The 'for' modifier creates a loop, and the 'my' is scoped
to the body of that loop (I think; I may not be exactly correct here). You
need to write it like this:

   my $length;
   $length += length($_) for @aho;

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


Reply via email to