You are using a text editor to modify the code, aren't you? Do the course materials cover how to use the text editor? Perl comes with a lot of tools that everyone finds quite useful (and often adequate) to debug errors so that you know what needs to be fixed. I see no reason why the course materials should repeat all that information.
Check out the perldebug manual. Better yet, start your script like this:
Then, at the first debugger prompt (DB<1>), type "h" for "help", then try stepping through the program with "n" (or use "s" at a subroutine call to step into that sub). After getting an input from a file, or a regex match or a split, use p $variable to look at what $variable contains, or p join "= =", @array to see the elements of @array, and so on.perl -d name_of_your_script.pl
Also, it looks like you were unable to figure out what I was saying in your "perl task3" thread about using while (<DATA>) ... and __DATA__ in your code. (And maybe you didn't understand what I was saying about the problems being related, and due to your data.) What I meant was:
Now, as for the problems you are still having, is there some chance that you are using a linux, unix or mac system, and the data is coming from a windows system (or from the web)?# my $file = "P1GroupCExercise2_trypsin.txt"; # commented out ... # open(FILE,$file) or die "error: unable to open file $file\n"; # co +mmented out while (<DATA>) # not "<FILE>" { ... } ... __DATA__ >Protein:HEMINF_F3_Complement_N182_S1226717_L118 |Peptide:13|Missed:0|Type:I|Enzyme:trypsin|Seq:R| ...
In the while loop that reads your data from the file, try these two things:
In reply to Re^3: perl task...
by graff
in thread perl task...
by huzefa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |