Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m confused

open files by perl?

Dear sir/madam;
I’m learning Perl by myself and I’m studying following book:
Beginning Perl for Bioinformatics
James Tisdall
Publisher: O'Reilly
First Edition October 2001
I can’t pass the ‘Reading Proteins in Files’ section. However I try (for example I copy the exact program that is in the book) to open a file, it fails. The error message that appears in the screen is as follow:
“Readline <> on closed filehandle PROTEINFILE at C:\Documents and Settings\Administrator\Desktop\per.pl line 9.”
1. What’s the meaning of this message and how can I debug it?
2. Where must I create my file that I want to open it?
Best Regards
Aboozar Monavvar Feshani
feshan1983@gmail.com
2 people have
this question
+1
Reply
  • Hi Aboozar,

    I would recommend downloading the example code for that book from our website here - http://examples.oreilly.com/begperlbio/

    It contains the file that the script is expecting to open - NM_021964fragment.pep
    That should be placed in the same directory as the script trying to read the file.

    I hope that helps,
    Chris
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • I had the same problem.

    Basically after you copy and paste the sequence into your notepad (assuming you are using windows), when you save it, you have to choose the option "all files" instead of "text documents" under the "save filetype" pulldown menu.

    Hope this helps
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • Well i'm no very good typing english, but this error occurs because :

    1.- The file 'NM_021964fragment.pep' must be in the same folder where you save the program.

    2.- Check the filename of the file will be the same to NM_021964fragment.pep.

    3.- the FileHandle PROTEINFILE perhaps can not read the variable $proteinfile or check all names of the variables.......

    $proteinfilename ='NM_021964fragment.pep';

    open (PROTEINFILE, $proteinfilename);
    $protein =;

    print "Here is the protein first Line: \n\n";
    print $protein;

    $protein = ;
    print "Here is the protein Seconf Line: \n\n";
    print $protein;

    $protein =;
    print "Here is the three line of the protein file :\n\n";
    print $protein;

    close PROTEINFILE;

    greating...!!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated