Loading ...
Sorry, an error occurred while loading the content.

defind variable

Expand Messages
  • elavazhagan perl
    Hia I got the diagnostic msg as follows while executing the mutate.pl.Kindlysuggest me how definding some of the variables will solve this error....... Use of
    Message 1 of 1 , Jul 6, 2007
    • 0 Attachment
      Hia



      I got the diagnostic msg as follows while executing the
      mutate.pl.Kindlysuggest me how definding some of the variables will
      solve this error.......



      Use of uninitialized value in substr at mutate.pl line 31, <STDIN> line 1.

      Thanks.

      E.Elavazhagan

      --------------------------------------------------------------------------------------------------------

      #!/usr/bin/perl
      use strict;
      use warnings;
      print " Enter the DNA Sequences";
      my $DNA;
      my @nucleotide;

      chomp($DNA = <STDIN>);
      my $i;
      my $mutant;
      srand(time|$$);
      $mutant=mutate($DNA);
      print "Mutate DNA\n\n";
      print " Here is the original DNA\n\n";
      print "$DNA\n";
      print "Here is the mutant DNA \n\n";
      print "$mutant\n\n";
      print "Here are 10 successive mutations\n\n";
      for ( $i=0;$i<=10;++$i)
      {
      $mutant=mutate($mutant);

      print ("$mutant\n\n");
      }
      exit;

      sub mutate {
      my ($DNA) =@_;
      my ($position)=randomposition($DNA);
      my ($newbase)=randomnucleotide();
      substr($DNA,$position,1,$newbase);
      return $DNA;
      }
      sub randomposition {
      my($string)=@_;
      return int rand length $string;
      }
      sub randomelement {
      my(@array)= @_;
      return $array[rand @array];
      }
      sub randomnucleotide {
      my ($nucleotides) = ('A','G','C','T');
      return randomelement(@nucleotide);
      }


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.