title: cannot run perl program: Can't locate Time/Piece.pm in @INC with perl5.8.4 and Can't locate DBI.pm in @INC with perl 5.12.3
body: <p>I have Solaris 10,i am trying to run a Perl program.</p>
  
  <p>I have two perl versions installed:</p>
  
  <p><code>/usr/bin/perl</code> of version 5.8.4</p>
  
  <p>and </p>
  
  <p><code>/usr/local/bin/perl</code> of version 5.12.3</p>
  
  <p>I have installed the DBI package (it got installed here, <code>/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/auto/DBI/.packlist</code>),the problem I get by executing the Perl program with different <code>perl</code> version is (In ubuntu its working fine).</p>
  
  <pre>bash-3.00# perl temp.pl
  Can't locate Time/Piece.pm in @INC (@INC contains: /usr/perl5/5.8.4/lib/sun4-   
  solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/sun4-solaris-64int
  /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/sun4- 
  solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl .) at    
  temp.pl line 4.
  BEGIN failed--compilation aborted at temp.pl line 4.
  
  bash-3.00# /usr/local/bin/perl temp.pl
  Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.12.3 
  /sun4-solaris /usr/local/lib/perl5/site_perl/5.12.3 /usr/local/lib/perl5/5.12.3/sun4- 
  solaris /usr/local/lib/perl5/5.12.3 /usr/local/lib/perl5/site_perl .) at temp.pl line5.
  BEGIN failed--compilation aborted at temp.pl line 5.</pre>
  
  <p>I have tried hell lot of ways but not getting how to run my Perl program on solaris.
  Could anybody help please.</p>
  
  <p>Below is my program. In fact it was redefined by @Borodin. Thanks a lot to him.</p>
  
  <pre><code>use strict;
  use warnings;
  
  use Time::Piece;
  use DBI;
  
  open my $log, '&lt;', '/opt/testlogs/test.log' or die "Unable to open log file: $!";
  
  my ( $count_start, $count_interim, $count_stop ) = ( 0, 0, 0 );
  
  while (&lt;$log&gt;) {
  
      if (/server start/) {
          $count_start++;
      }
      elsif (/server interim-update/) {
          $count_interim++;
      }
      elsif (/server stop/) {
          $count_stop++;
      }
  }
  
  print &lt;&lt;END;
  Start:   $count_start
  Interim: $count_interim
  Stop:    $count_stop
  END
  
  print localtime-&gt;strftime("%b %e %H:%M:%S"), "\n";
  
  my $dbh = DBI-&gt;connect( "DBI:Pg:dbname=postgres;host=localhost", "postgres", "postgres", { 'RaiseError' =&gt; 1 } );
  
  my $rows = $dbh-&gt;do(
      "insert into radius (server_start, server_stop, server_interim)
         Values ($count_start, $count_stop, $count_interim)"
  );
  
  printf "%d %s affected\n", $rows, $rows == 1 ? 'row' : 'rows';
  </code></pre>