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


in reply to Re: Avoiding Global Vars
in thread Avoiding Global Vars

But if I only declare $vrx within the while loop, then I will lose its value when I need to print it...

Try it with the data I supplied, and look at the different output...

1001foo 1002bar 1003hello 2001bish 2002bash

versus

1foo 2bar 3hello 1bish 2bash

So, it's not a question of whether I reference it outside the loop - rather the opposite, since if I did reference it elsewhere, then it would be global, and it wouldn't bug me... if you see what I mean.

map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
Tom Melly, pm (at) cursingmaggot (stop) co (stop) uk