CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Can't modify division ERROR

 



bjg896
New User

Apr 30, 2009, 4:47 PM

Post #1 of 4 (686 views)
Can't modify division ERROR Can't Post

I am getting an error in my code that I have never seen before. Does anyone know what this means and how to fix it?

"Can't modify division (/) in scalar assignment"


Code
elsif ($pLayer =~ /6/) {($pY - ($p{min_dist}{$pLayer}/2))/$p{min_dist}{$pLayer}=$pWidth; $pwh{6}{($pY + ($p{min_dist}{$pLayer}/2))/$p{min_dist}{$pLayer}}=$pWidth; }



FishMonger
Veteran / Moderator

Apr 30, 2009, 6:45 PM

Post #2 of 4 (683 views)
Re: [bjg896] Can't modify division ERROR [In reply to] Can't Post

I don't wish to be rude, but please don't write or post such bad code. Now, it's trivial for me to reformat that so that it's readable, but why should I need to. Help us to help you, by posting properly formatted and readable code.

Please Explain what your intention is and we'll tell you what you need to do to fix it.

Code
elsif ($pLayer =~ /6/) { 
($pY - ($p{min_dist}{$pLayer}/2)) / $p{min_dist}{$pLayer} = $pWidth;
$pwh{6}{($pY + ($p{min_dist}{$pLayer} / 2))/$p{min_dist}{$pLayer}} = $pWidth;
}


Are trying to assign a value to $pWidth or test if your expressions equate to the current value of $pWidth? Or are you wanting something else?


(This post was edited by FishMonger on Apr 30, 2009, 6:46 PM)


bjg896
New User

Apr 30, 2009, 8:13 PM

Post #3 of 4 (675 views)
Re: [FishMonger] Can't modify division ERROR [In reply to] Can't Post

Thanks for the reformat, I do apologize for the messy posting, my bad. In response to your question, I am trying to assign that value to the hash, not compare, so the single = is correct. Please let me know if you know what's causing the error.


bjg896
New User

Apr 30, 2009, 8:29 PM

Post #4 of 4 (674 views)
Re: [bjg896] Can't modify division ERROR [In reply to] Can't Post

Nevermind, I see the error now. I forgot to stick the front of the hash on the first line

$pwh{6}{($pY - ($p{min_dist}{$pLayer}/2))/$p{min_dist}{$pLayer}}=$pWidth;

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives