Just because a function is named foo in PHP doesn't mean it's named foo
in perl. 

As a matter of fact Perl has:

pop               <-- returns the top of an array and deletes it -- like
array_pop
push              <-- puts something into an array
shift             <-- returns the bottom of the array and deletes it
unshift           <-- puts something into the bottom of the array

With the above functions and arrays and hashes there are very few data
structures you can't create in a few minutes.

Also, PHP is a very different language then Perl, remember that.  And
PHP has a lot of problems.  I personally moved over to Perl after we got
sick of having to recompile PHP every time we wanted to use a new
function (Perl's modules work great).

It's actually kind of interesting.  If you look at what PHP is trying to
do with PHP 5 it is basically trying to copy a lot of Perl's object
oriented system.

But both languages are great.  Languages are like tools.  Not all
problems are nails, so if you see a screw you might need to use a
screwdriver (Perl), or if you see a bolt you might need a wrench (LISP),
etc.

-Dan

On Wed, 2003-11-12 at 14:44, John Dillon wrote:
> > perldoc
> >
> What he means is http://www.perldoc.com/ or something else, like something on c: or 
> a terminal window.
> 
> This is good.  I've learnt something...like when perl people say something, stick it 
> in google and see
> what comes up.
> 
> Let's see how the search for (web) solutions compares between perl and php.  
> Searching 'array' on
> this - perldoc - gives:
> 
> http://www.perldoc.com/cgi-bin/htsearch?words=array&restrict=perl5.8.0
> 
> (it's a list of questions - you need to look at the link.) By comparison, searching 
> on php.net gives:
> 
> http://uk2.php.net/manual/en/function.natcasesort.php
> 
> (it includes a list of functions.) OK, both are interesting.  Search on 'array_pop', 
> for instance - an
> slightly important function in form processing, on this link on php.net gives:
> 
> http://uk2.php.net/manual/en/function.array-pop.php
> 
> Choosing the first listed choice, perlfq4, on the perdoc.com link gives:
> 
> http://www.perldoc.com/perl5.8.0/pod/perlfaq4.html
> 
> OK.  Now, 'array_pop' is the (php) function which deletes an element from the end of 
> the array.  So,
> where is this on perl (I know that's unfair, I should go the other way also - see 
> below)?  The link on
> perldoc says blah blah blah in a rather two dimensional way and fails:
> 
> a.. Data: Arrays
>   a.. What is the difference between a list and an array?
>   b.. What is the difference between $array[1] and @array[1]?
>   c.. How can I remove duplicate elements from a list or array?
>   d.. How can I tell whether a certain element is contained in a list or array?
>   e.. How do I compute the difference of two arrays? How do I compute the 
> intersection of two arrays?
>   f.. How do I test whether two arrays or hashes are equal?
>   g.. How do I find the first array element for which a condition is true?
>   h.. How do I handle linked lists?
>   i.. How do I handle circular lists?
>   j.. How do I shuffle an array randomly?
>   k.. How do I process/modify each element of an array?
>   l.. How do I select a random element from an array?
>   m.. How do I permute N elements of a list?
>   n.. How do I sort an array by (anything)?
>   o.. How do I manipulate arrays of bits?
>   p.. Why does defined() return true on empty arrays and hashes?
> a.. Data: Hashes (Associative Arrays)
>   a.. How do I process an entire hash?
>   b.. What happens if I add or remove keys from a hash while iterating over it?
>   c.. How do I look up a hash element by value?
>   d.. How can I know how many entries are in a hash?
>   e.. How do I sort a hash (optionally by value instead of key)?
>   f.. How can I always keep my hash sorted?
>   g.. What's the difference between "delete" and "undef" with hashes?
>   h.. Why don't my tied hashes make the defined/exists distinction?
>   i.. How do I reset an each() operation part-way through?
>   j.. How can I get the unique keys from two hashes?
>   k.. How can I store a multidimensional array in a DBM file?
>   l.. How can I make my hash remember the order I put elements into it?
>   m.. Why does passing a subroutine an undefined element in a hash create it?
>   n.. How can I make the Perl equivalent of a C structure/C++ class/hash or array of 
> hashes or arrays?
>   o.. How can I use a reference as a hash key?
> Now, I'm not tempted to pursue any of those lines of enquiry, as they don't appear 
> to answer my
> question (or rather ask my question).  At this stage I would ask the group.  I mean 
> these are good -
> many are questions I have come up against in web coding.  But I want a list of perl 
> functions.  That
> might be the shortest way to the solution.
> 
> So, that didn't work in perldoc - let's give the advantage to perl and start with a 
> perl link:
> How do I reverse a string?
> Use reverse() in scalar context, as documented in perlfunc/reverse.
> 
> OK, and check against php.net:
> 
> http://uk2.php.net/manual-lookup.php?pattern=How+do+I+reverse+a+string%3F+â=en
> 
> not very helpful.
> 
> That says something...like perl started as a string and other things manipulation 
> extraction language -
> I mean how often do you want to reverse a string in web design? - whereas php 
> started as a HTML
> manipulation language and is good for database interaction, for which arrays are 
> important.
> 
> John
> 
> (jaw jaw is better than war war)
> 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to