jis wrote:
Hi

Hello,

I simply could not open a file which is in the same path as my script
is.
i could open the file if i explicitly mention the path. but i dont
want that..

my script is..

 use strict;
use warnings;
 my  $fil="pdef.txt";
open(DEFILE,"<$fil")|| die "Couldnt open pdef file - $!\n";


Any idea what is wrong..( the file exists in the same path as the
script is.)

Try this:

use FindBin '$Bin';

my $fil = "$Bin/pdef.txt";
open DEFILE, '<', $fil or die "Couldnt open $fil - $!\n";




John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to