At 1:25 pm +0100 7/10/02, I wrote:
> close F ;
> `open $f` ;
> END_OF_SCRIPT
Sorry -- I shouldn't have indented it, since END_OF_SCRIPT must be at
the beginning of the line, so...
#!/usr/bin/perl
### Script path will put the script in the Script Menu
$scriptpath = "$ENV{HOME}/Library/Scripts/junk.pl";
### The contents of the script:
$script = << 'END_OF_SCRIPT';
#!/usr/bin/perl
$f = "/tmp/junk.txt" ;
open F, ">$f" or die $!;
print F "\n\nSuccess at last ! Now run it from Script Menu." ;
close F;
`open $f`
END_OF_SCRIPT
### In case you forgot that Mac line endings won't
### do, change all carriage returns to line feeds.
$script =~ s~\015~\012~g;
open SCRIPT, ">$scriptpath" or die $! ;
### Write out the script
print SCRIPT $script ;
close SCRIPT;
### Make the script executable and run it
`chmod +x $scriptpath ; perl $scriptpath` ;