[Israel.pm] Perl Advocacy

david istermann interdist at gmail.com
Tue Dec 28 10:33:23 PST 2004

Zohar Kelrich  wrote:
> Is there anything wrong with:
> 8<----
> sub strreplc  [...]
Yes!! It's way too much code to type!

> and its name is 3 characters shorter!
Any particular reason for emiting the 'a' and 'e' from the name
(strreplc) and thus rendering it completely unreadable? Why not "strr"
- it's 4 characters only!
<HUMOUR>I thought the 8.3 convention days were over</HUMOUR>

Everyone else: thanks for your example code. However, PHP has
additional functionality which you're probably not aware of:
   str_replace(array("a.", "b."), "1.", $str);
       // will exchange both 'a' and 'b', by 1
   str_replace(array("a.", "b.", "c."), array("1.", "2."), $str);
       // will exchange 'a' by 1, 'b' by 2, and 'c' by empty string

How would you suggest implementing this (with 2-3 lines of actual processing) ?

And, my second comment was actually a serious one. I honestly see no
difference between indexing something by integers or by strings. The
array and the hash; Both have scalar values, tied to indices. Both can
be iterated. Why separate them so brutally when essentially they serve
the same purpose?


More information about the Perl mailing list