El Thursday 14 August 2008 12:42:15 jis va escriure:
> 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

you have to use full path or read all directories and files under the current 
directory with readdir.

-- 
Xavier Mas


______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com


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


Reply via email to