problem with division

Discussion in 'Perl Misc' started by tamiry, Apr 27, 2006.

  1. tamiry

    tamiry Guest

    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
    tamiry, Apr 27, 2006
    #1
    1. Advertising

  2. tamiry

    Paul Lalli Guest

    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
    Paul Lalli, Apr 27, 2006
    #2
    1. Advertising

  3. tamiry

    tamiry Guest

    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
    tamiry, Apr 27, 2006
    #3
  4. tamiry

    Paul Lalli Guest

    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
    Paul Lalli, Apr 27, 2006
    #4
  5. tamiry

    Ala Qumsieh Guest

    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
    Ala Qumsieh, Apr 27, 2006
    #5
  6. 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
    Jürgen Exner, Apr 27, 2006
    #6
  7. 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
    Tad McClellan, Apr 28, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. manzur

    Bigdecimal division problem

    manzur, Feb 23, 2006, in forum: Java
    Replies:
    5
    Views:
    8,114
    Patricia Shanahan
    Feb 23, 2006
  2. jamestuck21

    Binary Division Problem Help

    jamestuck21, Nov 30, 2006, in forum: C Programming
    Replies:
    22
    Views:
    1,714
    Al Balmer
    Dec 1, 2006
  3. division problem

    , Dec 22, 2006, in forum: C Programming
    Replies:
    13
    Views:
    738
  4. Replies:
    94
    Views:
    4,387
    ¬a\\/b
    Feb 9, 2007
  5. Jon

    Division problem

    Jon, Oct 13, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    301
    Alexey Smirnov
    Oct 13, 2007
Loading...

Share This Page