On Mon, Apr 14, 2008 at 1:06 AM, sanket vaidya <[EMAIL PROTECTED]> wrote: snip > my $scalar = "aaaba" =~ /a/g; snip > my $count = $scalar =~ tr/a//; snip > Count=0 > Scalar = 1 > > Please explain this behavior i.e. why the values of count & scalar are 0 & 1 > respectively? snip
$scalar holds the result of "aaaba" =~ /a/g in scalar context, which is 1 The string "1" has no "a"s in it so $count is 0 -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/