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

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

Replies are listed 'Best First'.
Re^5: Perl command line interpreter not working
by baperl (Sexton) on Oct 15, 2011 at 02:41 UTC
    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.
        I have a Math::Random and Math::Random::MT::Auto, but I don't see a Math::Random::MT on PPM the others I see are Bundle-Math-Random Math-Random-(AcceptReject,Cauchy,Discrete,GaussianRange,ISAAC,ISAAC-XS,MT-Perl,OO,Secure,TT800,Zipf) I tried the following on my code: I changed the use line to
        use Math::Random
        and left the rest the same... it doesn't give me the error anymore but it stops by saying
        Can't locate object method "new" via package "Math::Random::MT::Auto:: +Range" (perhaps you forgot to load "Math::Random::MT::Auto::Range"?)
        so, I wrote
        use Math::Random package MT;
        and now it says:
        Can't locate object method "curdir" via package "io" (perhaps you forg +ot to load "io"?)