in reply to Re: Recover a variable from a loop
in thread Recover a variable from a loop

Hello Laurent ! Concerning my constructor , it seems to work. When iam doing comparison within my loop , all is ok. Why i want to do comparison outside? Because i have to get all my browser' screenshots to be able to compare them. And my foreach return for each browser its screenshots. And if i want to compare 2 screenshots for 2 different browser, i think i have to do comparison outside loop.
Lost in translation

Replies are listed 'Best First'.
Re^3: Recover a variable from a loop
by Laurent_R (Canon) on May 26, 2016 at 21:22 UTC
    Then I have probably misunderstood your problem.

    But you report this error:

    Global symbol "%white" requires explicit package name at MyTest.pm lin +e 33.
    And, in the code that you have shown, line 33 is within the loop.

    If the code you show is not exactly the same as the one you run, it is difficult for us to figure out where exactly the error is occurring.

    Looking at it again, the error seems to be in:

    unless ($white{browser_name => $browser[0]} ...
    in which you use 'white' as a hash %white, not a scalar $white. Besides, $white has fallen out of scope anyway, so you would not be to access $white either, unless you had declared it before the start of the loop.