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

Re: [MacPerl] Porting a Perl Program



Developers writes:
|The part of the program which is giving me hassle is the '|sort'
|on the (open SESAME) line which obviously is not possible on a mac (no
|command line ;-).  The program is included below.

>From a casual perusal of the program from the open SESAME on down, it looks 
like you're:

1. Sorting the contents of the %seen hash by value, largest first.
2. Writing the results to keywords.out.
3. Reading in keywords.out.
4. Writing the top ten words back to keywords.out.

This can all be replaced by something like:

!WARNING! I usually test all code I post, but I haven't tested this.
It may not even pass a syntax check, but it should be close enough
that a little poking will fix it. !END OF WARNING!

@temparray = sort { $seen{$b} <=> $seen{$a} } keys %seen;
open TOPTEN, '>keywords.out' or die "Can't open file: $!\n";
print TOPTEN (@temparray ?
	@temparray > 10 ?
		join ("\n", @temparray[0..9]) :
		join ("\n", @temparray) :
	'NO_KEYWORDS'),
	"\n";
close TOPTEN;

|I am then hoping to write these values into a Filemaker DB on a Mac
|webserver running WebStar, Tango and Filemaker 3.0   Does any1 know how to
|do this??

I don't know much about Tango, but you could use AppleEvents to have a CGI
running under WebStar talk to FileMaker Pro. Check out issue 8 of The
Perl Journal (the lastest issue, I think).

Brian

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