in reply to when does the definition of a my variable take effect?

I don't think you can use it in the initialization EXPR. A simpler example than yours: my $result = $result + 1; wouldn't work either. But, there is no problem using it as an EXPR inside another one (as in your read() example.) I don't think: read(FH, my $buf = $buf . "foo", 512, 3) would work either.
-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: when does the definition of a my variable take effect?
by greenFox (Vicar) on Aug 23, 2002 at 04:21 UTC
    Or my favourite:

    chomp(my $var = <STDIN>);

    --
    Until you've lost your reputation, you never realize what a burden it was or what freedom really is. -Margaret Mitchell