On Aug 13, 7:46 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > 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
It did not make any difference. it says there is no such file in the $Bin path.. Ofcourse there is no such file in that path. i want to look in the path iam executing the code. Any one can hep me! jis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/