[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Changing Directories



You can also do the following:

#
#   -------------------------------------------------------------------
#   Proper Path Routine
#   -------------------------------------------------------------------
#
sub pp
{
    local( $fileName ) = @_;

    my $theDirectory = "Put your directory path here";

    my $curFile = "";

    if( $^O =~ /mac/i ){
        $curFile = "$theDirectory:$fileName";
        }
        elsif( $^O =~ /ibm/i ){
            $curFile = "$theDirectory\\$fileName";
            }
        else {
            $curFile = "$theDirectory/$fileName";
            }

    return( $curFile );
}

Then you just call this routine with the file name you want
to use.  Like so:

	&pp( "myfile.dat" );

and it returns the proper path to that file.  Use BBEdit to
insert the initial path to where the files are.  On a Unix
box you could use VI's ":r!pwd" to read the directory path
into the program and then put it into the double quotes.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch