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

It's a guess, but most likely it's a wrong un. Getting the file read mode wrong is unlikely to cause a crash that would trigger Window's error reporting.

Although the OP didn't give us enough code to reproduce the problem, he did give us enough information to provide some pointers and there was nothing there that indicated file I/O related problems.

True laziness is hard work
  • Comment on Re^2: Perl command line interpreter not working

Replies are listed 'Best First'.
Re^3: Perl command line interpreter not working
by baperl (Sexton) on Oct 15, 2011 at 02:11 UTC
    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.

      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.

      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....