in reply to Re^2: Perl command line interpreter not working
in thread Perl command line interpreter not working

I don't believe this is an I/O related problem. here's the relevant code
use Math::Random::MT::Auto::Range; my $rng = Math::Random::MT::Auto::Range->new(LO => 10000, HI => 999 +99,TYPE => 'INTEGER'); my $A = $rng->rrand(); my $B = $rng->rrand(); my $str = "$A$B";
of course, when I comment it out, my file compiles, so I know this is the cause of the problem.

Replies are listed 'Best First'.
Re^4: Perl command line interpreter not working
by GrandFather (Saint) on Oct 15, 2011 at 02:17 UTC

    Your code runs fine for me. I've edited it a little to report versions:

    use strict; use warnings; use Math::Random::MT::Auto::Range; my $rng = Math::Random::MT::Auto::Range->new ( LO => 10000, HI => 99999, TYPE => 'INTEGER' ); my $A = $rng->rrand (); my $B = $rng->rrand (); my $str = "$A $B"; print "perl version $]\n"; print "Math::Random::MT::Auto::Range version $Math::Random::MT::Auto:: +Range::VERSION\n"; print $str;

    which for me prints:

    perl version 5.010001 Math::Random::MT::Auto::Range version 6.16 33649 69127

    with the numbers in the last last line varying as expected from run to run. I'm running it on Windows XP btw.

    True laziness is hard work
      that's strange...I wonder whether it has anything to do with the fact that I am running Windows 7. do you have any suggestions on another random number generator i can substitute this with....I don't care much about using only this.
Re^4: Perl command line interpreter not working
by GrandFather (Saint) on Oct 15, 2011 at 02:25 UTC

    Oh, and you could simplisticly provide a replacement by:

    use strict; use warnings; use Math::Random::MT qw(); package Range; sub new { my ($class, %params) = @_; return bless \%params, $class; } sub rrand { my ($self) = @_; my $num = Math::Random::MT::rand ($self->{HI} - $self->{LO}) + $se +lf->{LO}; $num = int $num if $self->{TYPE} eq 'INTEGER'; return $num; } package main; my $rng = Range->new ( LO => 10000, HI => 99999, TYPE => 'INTEGER' ); my $A = $rng->rrand (); my $B = $rng->rrand (); my $str = "$A $B"; print "perl version $]\n"; print "Math::Random::MT version: $Math::Random::MT::VERSION\n"; print $str;
    True laziness is hard work
      I changed the use statement to what you have above and now I get the following error
      Can't locate Math/Random/MT.pm in @ INC error
      btw, I went into my Perl directory C:/Perl64/site/lib/Math/Random/MT and I see Auto and Auto.pm in there, so I don't quite understand. I am working on Windows 7. any other suggestions....

        Install (PPM) Math::Random::MT.

        It is a different package completely (and simpler and more reliable) to Math::Random::MT::Auto.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.