| Author |
new to perl file esist
|
|
|
| hello all iamnew toperl and iknow this qustion is asked many times. but
stili coul dnot getit working this is wat i have
$home= "$parse/audit/$check/system/report.out";
chomp($home);
if (-e $home) {
print " file exist ";
}else {
print "file does not exist";
}
The file exist in the directory but it always prints it does not exist
..I tried in a test program but when i plug in to the main program it
does not work any help pls
thnks
| |
| kenslaterpa@hotmail.com 2006-07-28, 9:56 pm |
|
sivga wrote:
> hello all iamnew toperl and iknow this qustion is asked many times. but
> stili coul dnot getit working this is wat i have
>
>
> $home= "$parse/audit/$check/system/report.out";
>
> chomp($home);
>
> if (-e $home) {
>
> print " file exist ";
>
> }else {
>
> print "file does not exist";
> }
>
> The file exist in the directory but it always prints it does not exist
> .I tried in a test program but when i plug in to the main program it
> does not work any help pls
>
>
> thnks
You need to provide a complete script that exhibits the problem.
Otherwise, I can only speculate on what is wrong.
If your test program works, but your main program doesn't, that is
probably a sign that the variable '$home' does not contain the value
you think it does.
Ken
| |
| usenet@DavidFilmer.com 2006-07-28, 9:57 pm |
| sivga wrote:
> $home= "$parse/audit/$check/system/report.out";
> The file exist in the directory but it always prints it does not exist
Change your print statement to be more informative, such as:
print "file '$home' does not exist";
Now Perl will tell you the name of the file it is looking for. Does it
match the name you think it is looking for? (especially the first part
of the path, which comes from $parse, which might not contain what you
think it contains).
--
David Filmer (http://DavidFilmer.com)
| |
|
| yes i had da same prob two days ago...
just check the filename and path u r looking for is correct as Mr.
David said.
|
|
|
|