Re: No such file or directory

[email protected] ("Mimi Cafe")
Newsgroups perl.beginners
Message-ID <[email protected]>
> I am on Windows so it should not be case-sensitive. The script and all
> required files in one folder. I pass 3 arguments to the script (script.pl
> file1 file2 file3)and I can open the first file stored in $ARGV[0] as seen
> below:
>
> my $ad_clients = shift @ARGV;
>
> open (ADFILE, "<", $ad_clients) or die "Could not open $ad_clients for
> reading: $! \n"; # This works fine!
> my @ad_clients = <ADFILE>;
> close ADFILE;
>
> my %inputclient;
>
> foreach my $supplied (@ARGV){
> open (INPUTFILE, "<", $supplied) or die "Could not open $supplied for
> reading: $!\n # This does not works! Error: No such file or directory
>
Mimi

>
>
>
>
> On 29/05/2008, Ken Foskey <[email protected]> wrote:
>>
>>  On Thu, 2008-05-29 at 11:45 +0100, Mimi Cafe wrote:
>>
>> my script is in the same directory as my files, but it cannot find the file
>> ABC.txt in open() below.
>>
>> foreach my $supplied (@ARGV){
>>  # Output file name set of element currently processed.
>>
>>  # Open file to read from.
>>  open (INPUTFILE, "<", "$supplied") or die "Could not open $supplied: $!\n";
>> # Error: No such file or directory.
>> }
>>
>> Any help
>>
>> Mimi
>>
>>
>>
>> for starters you might want to look at the <> operator:
>>
>> while( <> ) {
>> }
>>
>> Will read each file on the command line in sequence, saves you thinking
>> about it.
>>
>> If it is Unix it is case sensitive,  is this your problem?
>>
>> Are you actually in the directory?   `bin/myscript.pl bin/ABC.txt`
>>
>>
>>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.