http://www.perlmonks.org?node_id=392308


in reply to Re: Global vars not accessable globaly
in thread Global vars not accessable globaly

Nice example but doesn't really help a bit more plain text would be better. and what is a think-o?
Oh and the content of final1 in that statement is correct. When i print it there it works just fine.

Replies are listed 'Best First'.
Re^3: Global vars not accessable globaly
by PodMaster (Abbot) on Sep 20, 2004 at 09:33 UTC
    Nice example but doesn't really help a bit more plain text would be better
    Can you answer why @foo1 doesn't contain 666 and 123?

    In your original question you say the array final1 and final2 are declared as global but i can only print them in there function. the print @final1 just below that and the print at the end do not work..... .

    • "It doesn't work" is not a very good explanation (some would say it is not an explanation at all) (How (Not) To Ask A Question)
    • my snippet demonstrates why @final1 and @final2 don't contain what you expect. @foo1 = 123; is not the same as push @foo1, 123;
    what is a think-o?
    Its a brain fart (dict thinko)

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re^3: Global vars not accessable globaly
by BrowserUk (Patriarch) on Sep 20, 2004 at 09:30 UTC
    @array = 1; print "@array"; 1 @array = 2; print "@array"; 2 @array = 1; push @array, 2; print "@array"; 1 2

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon