in reply to Problem localizing $_ using threads::shared

I get the same results with either sub, but you don't show the code where you are calling doit_my().

Is it possible that you made a mistake? In the code where you call the local version you have:

$$x{foo} = join " ", map '"'.doit_local($_).'"', .....

Ie. You are passing $_ into doit_local(), but nowhere in your code is $_ ever assigned a value?

Inside the sub, you then local $_ and assign $_ to it, but you have still never assigned any value, so it is undef, whihch explains the 'uninitialized value' errors.

If I call doit_my($_), I get exactly the same results and errors. What did you pass to doit_my()?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Problem localizing $_ using threads::shared
by duelafn (Parson) on Nov 13, 2005 at 13:08 UTC

    I do have a map in there that sets $_. The doit_my version is exactly the same with s/doit_local/doit_my/ on that one line:

    $$x{foo} = join " ", map '"'.doit_my($_).'"', 'find', ...

    Good Day,
        Dean