[Glastonbury] Questions
Sean Miller
glastonbury at mailman.lug.org.uk
Thu Jul 17 08:42:00 2003
> Perl is _not_ platform independent on anything other than Unices/Linux.
> The Perl port to Windows 32 bit by Active State is specifically not
> supported by Larry Wall and co. for example. Because Windows / MacOS
> do things differently, you can't rely on being able to use Perl to the
> same extent.
> The basics, however, are similar. The problem comes when you want
> to use CPAN stuff and find it plain won't work on your platform.
I'm just a basic sort of fella! ;-)
To clarify, the advice re. using perl rather than shellscripts was in a
fairly simple context. Let's say, for example, that you have a file
pruning script that you want to run on Windows and Linux... do you write
two different scripts, one using 'find' etc. in Linux and the other one
using some nasty Micro$oft thing? Better to use Perl.
> If you've not programmed before, Perl can be scary whereas basic shell
> scripts are potentially conceptually easy.
>
> #/bin/sh
> date ; time ; w
True. But, #!/bin/sh might work better, lol! ;-)
Sorry. I'm wicked this time of the morning :-)
> ps -elf | grep $USER and so on ...
Yes, I agree. Shell scripts are very intuitive compared to perl. Wasn't
really trying to sell perl, simply recount some advice from ages ago at a
time when I was so proficient in shell scripting that I really could not
be botherered to take it... if I were starting from scratch now, I'm not
sure which I'd learn.
For complex operations perl can also be faster due to the fact that shell
commands are fairly limited and therefore in order to achieve a lot of
things you are generally piping programs into programs (eg. sed, awk,
find, ps, grep, cut, sort etc.) whereas in perl you are using inbuilt
commands.
> and you need shell script reading ability to understand what init
> scripts and so on are actually trying to do, anyway.
I guess so.
> Just my inherent biases showing :)
I tend to program in shell because it's what I know... but there are
advantages to perl (speed, as above, being quite a significant one)...
Sean