ShermW0829 has asked for the wisdom of the Perl Monks concerning the following question:
I have opened, read from, and written to files using PERL in the past. Now I think I am doing the same thing but the open states the below answers.
Found "linux_complete_command_set.txt" Unable to open linux_complete_command_set.txt: No such file or directo +ry
Below is the code. The file exists within the same directory where I am running the PERL file hence the "./". I tried running the file without the ./ with the same results.
#! /usr/bin/perl -w use v5.14.2; use strict; my $file = "linux_complete_command_set.txt"; if ( -e "$file" ) { print "\"Found $file\"\n"; } open ( FH0, '<./$file' ) or die "Unable to open $file: $!\n"; while ( <FH0> ) { print "$_\n"; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl can find the file but can not open the file
by choroba (Cardinal) on Mar 09, 2013 at 18:49 UTC | |
by ShermW0829 (Sexton) on Mar 09, 2013 at 19:00 UTC | |
|
Re: perl can find the file but can not open the file
by McA (Priest) on Mar 09, 2013 at 19:37 UTC | |
|
Re: perl can find the file but can not open the file
by graff (Chancellor) on Mar 09, 2013 at 19:42 UTC | |
|
Re: perl can find the file but can not open the file
by karlgoethebier (Abbot) on Mar 09, 2013 at 20:30 UTC | |
|
Re: perl can find the file but can not open the file
by toolic (Bishop) on Mar 10, 2013 at 02:30 UTC | |
by ShermW0829 (Sexton) on Mar 10, 2013 at 22:24 UTC | |
by 7stud (Deacon) on Mar 11, 2013 at 05:23 UTC | |
by ShermW0829 (Sexton) on Mar 11, 2013 at 14:53 UTC |