paths in Perl

2009-03-12 Thread Wayne Brissette
I'm new to writing perl and perl in Mac OS X, although I've had plenty of 
AppleScript experience. In fact, at one time, a lot of the Apple Support site 
relied on scripts I wrote to get data from point A to point B via AppleScripts 
I wrote. 

Anyhow, I'm playing around with reading in some static files in perl, what I've 
discovered is that if put the script in the same directory as the text file, it 
works properly. However, if I try to provide a path like: ~/Documents/log_files/

The script can't open the file. is there a trick in Mac OS X to do this that is 
outside the perl norm? 

Wayne


Re: paths in Perl

2009-03-12 Thread David Cantrell
On Thu, Mar 12, 2009 at 09:27:54AM -0400, Wayne Brissette wrote:

 Anyhow, I'm playing around with reading in some static files in perl, what 
 I've discovered is that if put the script in the same directory as the text 
 file, it works properly. However, if I try to provide a path like: 
 ~/Documents/log_files/
 
 The script can't open the file. is there a trick in Mac OS X to do this that 
 is outside the perl norm? 

Using ~ as a shortcut for your home directory is a shell-ism, perl
doesn't handle it.  Replace it with $ENV{HOME}, or if you want your code
to be portable to non-Unix platforms, use the File::Homedir module.

-- 
David Cantrell | A machine for turning tea into grumpiness

fdisk format reinstall, doo-dah, doo-dah;
fdisk format reinstall, it's the Windows way