Try something like this: use Cwd; my $starting_dir = getcwd(); $file = GUI::GetOpenFileName(... open (FILE , ">$starting_dir/datafile.txt");
You could also do call 'chdir $starting_dir;' before doing the open, however this probably not does not work if the user changes to a different drive letter. Indy Singh IndigoSTAR Software -- www.indigostar.com ----- Original Message ----- From: "christopher sagayam" <[EMAIL PROTECTED]> To: <perl-win32-gui-users@lists.sourceforge.net> Sent: Monday, January 15, 2001 4:23 AM Subject: [perl-win32-gui-users] GUI::GetOpenFileName and current directory of perl script > sub button1_tab1_Click { > $file = GUI::GetOpenFileName( > -owner => $W, > -directory => "C:\\", > -title => "Location of ", > -file => $file, > ); > open (FILE , ">./datafile.txt") > print FILE $file; > close(FILE) > } > > > Now I am intending to do this > > 1) Store the full path of the openend file to a file "datafile.txt" > 2) I have used ./datafile.txt assuming that the file will get stored in the > SAME folder as that of my PERL SCRIPT > > BUT > > when I open the file dialog and choose a file say "D:\mywork\pages\one.html" > > the datafile.txt gets written in D:\mywork\pages\ > > when I open the file dialog and choose a file say "C:\important\rdf.exe" > > the datafile.txt gets written in C:\important\ > > my perl script is all along at > > E:\perlscripts\ > > SO how do I achieve my objective > > chris > > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >