On 12/12/2007, Auxence Sima <[EMAIL PROTECTED]> wrote: > > Hi everyone. > I d like to have u guys input about my code. Im writing a perl script > that would generate some primers. my input file calles " output.txt ) was > generated from primer3. > if u guys can take a look at my script and tell me what u detect that > needs to be correcte/ or something that i missed to include. hope to hear > from u all. > > > > #! /usr/bin/perl- w > #programpro.pl > use strict; > use primer3; > > # initialize variables > > my %sequences; > my $key; > my $file = "output.txt"; > > # Read a primer3 output file > > my $primer3 = primer3-> new ( -file=>"data/output.txt"); > # iterate over sequences
%sequences has no keys at this stage. You've declared %sequences but haven't assigned anything to it so this loop will not happen. Foreach should be foreach, perl is case senitive. You can declare my $key here and drop it from above keeping it's scope within the block. foreach my $key (keys %sequences) { Foreach $key (keys (%sequences)) { > > # Search for primers You've already declared $primer above. Are these meant to be separate variables? my $primer = primer3=>new ($key, > $sequences {$key}; > print "$key\nLeft\t\t\tRight\n"; > while ($primer=>getNextpair ( )) { > print $primer=> LeftOligo ( ) . "\t" . > $primer=>RightOligo( ) . "\n" ; > } > Print "\n"; > > } I am not sure if it's you mail client but the are too many capitalised words in what you have shown. What happens if you run it? I imagine that with the perl -w you would get lots of warnings and errors.