Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: Avoiding Global Vars

by Melly (Hermit)
on Sep 22, 2009 at 17:01 UTC ( #796760=note: print w/replies, xml ) Need Help??

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


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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://796760]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-05-25 22:44 GMT
Find Nodes?
    Voting Booth?