samaniac has asked for the wisdom of the Perl Monks concerning the following question:
Hey guys, I've heard you're the ones to go to if in need of help with anything perl-related. Well, I have a question for you. First look at this part of my code:
#!/usr/bin/perl #intconv2.plx use warnings; use strict; print "Please enter a normal decimal number less than 256: ", "\n"; my $dec; $dec=<STDIN>; my$binc1=$dec&128; if ($binc1!=0) { our$bin1=1; } else { our$bin1=0; } print"The number in binary is: $bin1 \n";
I know this isn't a correct way of converting from decimal to binary but as I said this is only part of my code. My problem is that I get an error saying "Variable "$bin1" is not imported at C:\PerlScripts\intconv2.plx line 90. Global symbol "$bin1" requires explicit package name at C:\PerlScripts\intconv2.plx line 90. I thought this meant that the variable $bin1 I declared was not global and I don't know how to fix this, unless that's not even the problem. Please help me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need a little coding help
by ikegami (Patriarch) on Nov 25, 2010 at 18:21 UTC | |
by samaniac (Initiate) on Nov 25, 2010 at 20:19 UTC | |
by ikegami (Patriarch) on Nov 25, 2010 at 21:12 UTC | |
|
Re: Need a little coding help
by shawnhcorey (Friar) on Nov 25, 2010 at 23:36 UTC | |
|
Re: Need a little coding help
by umasuresh (Hermit) on Nov 25, 2010 at 17:58 UTC | |
|
Re: Need a little coding help
by biohisham (Priest) on Nov 25, 2010 at 22:52 UTC | |
|
Re: Need a little coding help
by roc (Sexton) on Nov 29, 2010 at 16:02 UTC |