Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I created a text file 'fragment.txt' and saved it in the same directory..
I have used the following code to open the file
#!/usr/bin/perl -w $proteinfilename = 'fragment.txt'; open(PROTEINFILE, $proteinfilename); $protein = <PROTEINFILE>; close PROTEINFILE; print " here is the protein:\n\n"; print $protein;
but the output I get is:
readline() on closed filehandle PROTEINFILE at C:\strawberry\perl\bin\ +trial1.pl line 4 here is the protein: Use of uninitialized value $protein in print at C:\strawberry\perl\bin +\trial1.pl line 7
I face the same problem with trying to open any other file as well..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cannot open file in Strawberry Perl
by Corion (Patriarch) on Apr 25, 2011 at 11:46 UTC | |
|
Re: Cannot open file in Strawberry Perl
by syphilis (Archbishop) on Apr 25, 2011 at 11:50 UTC | |
|
Re: Cannot open file in Strawberry Perl
by ww (Archbishop) on Apr 25, 2011 at 12:25 UTC | |
|
Re: Cannot open file in Strawberry Perl
by Balaton (Initiate) on May 09, 2012 at 20:35 UTC | |
by Anonymous Monk on May 09, 2012 at 20:38 UTC | |
|
Re: Cannot open file in Strawberry Perl
by Balaton (Initiate) on May 10, 2012 at 21:44 UTC | |
by Anonymous Monk on Dec 06, 2016 at 11:32 UTC | |
by Anonymous Monk on Jul 10, 2013 at 07:25 UTC |