Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > problem with division

Reply
Thread Tools

problem with division

 
 
tamiry
Guest
Posts: n/a
 
      04-27-2006
I know it sounds funny, but entering this line to the code,

my $num = 1/100;

causes the "compiler" to say stuff like,

syntax error at pkg.pm line 167, near ")
{"
syntax error at pkg.pm line 175, near ")
{"
Global symbol "$self" requires explicit package name at pkg.pm line
176.
....

the lines mentioned come after this line, and they are perfectly OK. If
I change it to

my $num = 1*100;

it works great. I also included

use strict;
use warnings;

at the head of the file.

any ideas? please?
(maybe the "compiler" somehow thinks that '/' starts a string quote ?)

thaks a lot

 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      04-27-2006
tamiry wrote:
> I know it sounds funny, but entering this line to the code,
>
> my $num = 1/100;
>
> causes the "compiler" to say stuff like,
>
> syntax error at pkg.pm line 167, near ")
> {"
> syntax error at pkg.pm line 175, near ")
> {"
> Global symbol "$self" requires explicit package name at pkg.pm line
> 176.
> ...
>
> the lines mentioned come after this line, and they are perfectly OK. If
> I change it to
>
> my $num = 1*100;
>
> it works great. I also included
>
> use strict;
> use warnings;
>
> at the head of the file.
>
> any ideas? please?
> (maybe the "compiler" somehow thinks that '/' starts a string quote ?)


There's no real way to know that without seeing the actual code.
I find the most likely cause something you're not showing us. Please
parse your problem down to the shortest complete runnable script that
still exhibits the problem, and then post it.

In the meantime, please make sure you read the Posting Guidelines for
this group.

Paul Lalli

 
Reply With Quote
 
 
 
 
tamiry
Guest
Posts: n/a
 
      04-27-2006
a. thanks for the fast reply
b. Ill try and minimize the code
c. where do I see the posting rules, please? i tried "about group" but
it wasn't there.
d. sorry

 
Reply With Quote
 
Paul Lalli
Guest
Posts: n/a
 
      04-27-2006
tamiry wrote:
> a. thanks for the fast reply
> b. Ill try and minimize the code
> c. where do I see the posting rules, please? i tried "about group" but
> it wasn't there.
> d. sorry


I have no idea what "About group" means. I'm guessing you're coming
from Google Groups. If that's true, please take to heart that little
notice at the top of your posting box:

"The group you are posting to is a Usenet group. Messages posted to
this group will make your email visible to anyone on the Internet."

In other words, this is not a Google Group. Google does not own this
in any way shape or form. This is Usenet.

The Posting Guidelines are posted to this group twice a week. Simply
look for a recent message with the topic containing "Posting
Guidelines". If you really can't find it, use Google's archive to
search the group for that phrase. I'm sure you'll find it.

Paul Lalli

 
Reply With Quote
 
Ala Qumsieh
Guest
Posts: n/a
 
      04-27-2006
tamiry wrote:

> I know it sounds funny, but entering this line to the code,
>
> my $num = 1/100;
>
> causes the "compiler" to say stuff like,
>
> syntax error at pkg.pm line 167, near ")
> {"
> syntax error at pkg.pm line 175, near ")
> {"
> Global symbol "$self" requires explicit package name at pkg.pm line
> 176.
> ...
>
> the lines mentioned come after this line, and they are perfectly OK. If
> I change it to
>
> my $num = 1*100;
>
> it works great. I also included


Since you don't show any code, I can only guess. My guess is that you have a
runaway regular expression, that is missing a closing /, hence you get the
error when you have a / in your division statement.

--Ala

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      04-27-2006
tamiry wrote:
> I know it sounds funny, but entering this line to the code,
>
> my $num = 1/100;
>
> causes the "compiler" to say stuff like,
>
> syntax error at pkg.pm line 167, near ")


Sorry, can't reproduce your problem:

C:\tmp>type t.pl
use warnings; use strict;
my $num = 1/100;

C:\tmp>t.pl

C:\tmp>

jue


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      04-27-2006
tamiry <> wrote:

> (maybe the "compiler" somehow thinks that '/' starts a string quote ?)



I doubt that, since '/' DOES NOT start a string quote.


--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Division problem Jon ASP .Net 2 10-13-2007 07:54 PM
division by 7 without using division operator krypto.wizard@gmail.com C Programming 94 02-09-2007 06:57 AM
division problem jamesonang@gmail.com C Programming 13 12-27-2006 01:34 AM
Binary Division Problem Help jamestuck21 C Programming 22 12-01-2006 08:50 PM
Bigdecimal division problem manzur Java 5 02-23-2006 04:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57