On Sun, 2008-12-14 at 22:21 +0800, itshardtogetone wrote:
> Hi,
> I wish to open a file datafile.txt which is stored in the same location as 
> the perl script, so how do I write it down?
> 
> open (FILE,'<',"                                          ") || die "no such 
> files $!\n"; 
> 
> 

use File::Basename;
my $Script_dir = dirname( $0 );
my $file = "$Script_dir/datafile.txt";
open my $fh, '<', $file or die "cannot open $file: $!\n";



-- 
Just my 0.00000002 million dollars worth,
  Shawn

The key to success is being too stupid to realize you can fail.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to