On Thu, Feb 28, 2008 at 7:13 PM, Ben Crane <[EMAIL PROTECTED]> wrote:
> Jay,
> Thanks for your response copied below. I really don't want to go to Perl 5.x
> and all that newfangled stuff.
> Here's my code ending with the offending line 7 according to my BBEdit error
> msg also copied below. I think the problem must be something simple. BBEdit
> says the syntax is OK, and it does run OK under Classic. I've tried
> different path name conventions, ( / instead of : ) but that doesn't seem to
> help. All files have 777 permissions.
> 1 #!/usr/bin/perl
>  2
>  3 # This script converts the file names of scans and images formed from the
> scans from consignor IDs
>  4 # to lot IDs. The file g5hd:newScansImages:trans is formed by exporting
> from the filemakerPro records that
>  5 # describe the lots and contain the images
>  6
>  7 open ("trans", "g5hd:newScansImages:trans") or die "Error, can't open";
>  8

Hi Ben,

First, you rinstinct to convert to OS X/unix-style filenames was correct.

Second, you'll want to add "$!" to your die messages. That will tell
you *why* the operation failed:

    open ("trans", "g5hd:newScansImages:trans") or die "Error, can't open: $!";

In this case, it's probably because the file doesn't exist, or your
script doesn't have read permissions for it, but you won't know for
sure until you see what $! returns on your system.

If the file does exist, make sure the user your script runs as can
read the file.

If the file doesn't exist, make sure you are opening the file in
read/write mode see perldoc open for more information, but something

    open(TRANS, ">", "path"); # or
    open(TRANS, "<", "path");

should do what you need, depending on whether you need to read or write.

Also, keep in mind that filehandles should be barewords or variables,
not double-quoted strings. That can bite you later. By convention,
they're also usually uppercase. That makes it easier to tell the
difference between filehandles and other things.


-- jay
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.downloadsquad.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to