print"enter the input directory path:\n"; chomp($indir=<STDIN>); print"enter the events directory path:\n"; chomp($evdir=<STDIN>); print"enter the output directory name:\n"; chomp($tmpdir=<>);
Why do you use <STDIN> for the first two variables and <> for the third?
opendir(DIR,".") or die "$!"; my @files=readdir DIR; close DIR;
You have to use closedir to close a directory handle opened with opendir.
open evein,$ever or die $!; flock(evein, LOCK_EX) or die "Cannot lock - $!"; while (<evein>) { chomp; next unless length; my ($key,$value)=split /===/,$_; $result{$key}=$value; } close(evein);
The value of $ever doesn't change inside this loop so this code should be outside the loop where $ever is set.
open evein,$ever or die $!;
You are trying to open 'events.txt' from a directory entered by the user. If the user uses a relative path then your program won't be able to find it. You should give the user more information than just the contents of $!.
flock(evein, LOCK_EX) or die "Cannot lock - $!";
You can't LOCK_EX a file opened only for input, only for output.
while(<fln>) { my ($line)=$_;
That is usually written as:
while ( my $line = <fln> ) {
In reply to Re: permission denied error when reading thru set of text files at once!!!
by jwkrahn
in thread permission denied error when reading thru set of text files at once!!!
by seek_m
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |