problem with division

T

tamiry

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
 
P

Paul Lalli

tamiry said:
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
 
T

tamiry

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
 
P

Paul Lalli

tamiry said:
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
 
A

Ala Qumsieh

tamiry said:
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
 
J

Jürgen Exner

tamiry said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top