Phil was talking about using Ruby to munge a complex text file into a form that he could analyze and I asked why Ruby rather than perl. At the same time, I remembered that I've been meaning to install the command-line version of PHP. So, while I was waiting for his reply, I went ahead and downloaded and installed a PHP package that provides the CLI version (and a bunch of other useful tweaks). Phil's response, ultimately, was that he finds perl's syntax obscure enough that its difficult to write something on his own. That's very much my experience -- whenever I need to write something in perl, I have to find a program that does something similar and tweak it (often a program I've written before, which was a tweaked version of something else). This morning, though, I installed and tested the PHP package and find that it works perfectly. PHP is perhaps not the best language for shell scripts, but I know PHP so much better than anything else, that it will be simpler to be able to write shell scripts in PHP, rather than having to pore over a manual or manpages whenever I want to do something. And it didn't seem to break anything else, which is a relief. I'll probably install the package in the BCRC and perhaps I'll have my students work with PHP at the command line before trying to craft webpages with it. It opens up possibilities.
Hi, here are a couple articles you or your students might find helpful:
- Replacing Perl Scripts with PHP Scripts
- Using PHP As A Shell Scripting Language
- I've sometimes had run to php scripts from the command line as cron jobs: Scheduling tutorial
DougHolton (Thanks, Doug!)