$file = File::Spec->rel2abs($file) if !File::Spec->file_name_is_absolute($file);
No need for the if check, rel2abs will work fine with an absolute path (and will clean it up as well which may help, and should never hurt).
system(qq{osascript -e 'tell application "Finder" to reveal "$file" as POSIX file as alias'});
system(qq{osascript -e 'tell application "Finder" to activate'});
You can feed multi line scripts to osascript, and the script you want is really:
tell application "Finder" reveal posix file "$file" as alias activate end tell
So you can do this:
system(qq{osascript -e 'tell application "Finder"' -e 'reveal posix file "$file" as alias' -e 'activate' -e 'end tell'});
The "as alias" part converts the posix file specifier to an alias handle which the Finder requires for some reason (usually they will be automatically coerced, but not in this case I guess).
Enjoy, Peter.
-- <http://www.interarchy.com/> <http://download.interarchy.com/>