Talk:Perl Programming/Function reference

I removed the last two examples of grep, as they are better accomplished through map and for respectively. grep should not be used in a void context. MrItty 18:54, 15 Nov 2004 (UTC)

"Program Functions"
This needs to be cleaned up. It seems that all of the functions in this section (save 'caller') are listed elsewhere in the page. I've already removed my and local, as they were defined in Misc Functions. The rest seem to be listed under Module Functions. -- MrItty 19:53, 16 Nov 2004 (UTC)

"examples"
At the bottom, it states that uc and lc reverse each other. This sets off alarm bells- is lc(uc("QWERTY")) actually "qwerty"? I don't know Perl, so it may be intelligent enough to make that distinction. Not a user-- ARC. 13:24, 3 Jun 2005 (EST)


 * lc lowercases an entire string. uc uppercases it.  so in that sense, yes, they're "reverse".  But lc(uc("Foo")) is not "Foo". --RandalSchwartz 00:41, 28 Jun 2005 (UTC)

Structure
I've made this page my definitive perl function reference page but it is still quite unstructured and incomplete.

Might I suggest: ==Category== ===Function=== ====Action==== Description of action ====Returns==== Description of return value ====Syntax==== function($variable = default value); ====Example==== Example 1; Example 2; ====See Also==== * link to function - To {Description of action} * link to function - To {Description of action} For example: ==Array functions== ===pop=== ====Action==== Remove the last element from an array ====Returns==== The element removed ====Syntax==== pop(@array = @_); ====Example==== $LastElement = pop(@MyArray); ====See Also==== * Function reference - To remove an a set of elements from an array * Function reference - To remove the first element from an array

===splice=== ====Action==== Remove a set of elements from an array. Optionally, replace those elements with a new array ====Returns==== An array of elements removed ====Syntax==== splice(@array=@_,$first=0,$last=$#array,@replacementArray=) ====Example==== splice(@Array); # Removes all elements from array splice(@Array, 10); # Removes from element 10 to the end of the array splice(@Array, -10); # Removes the last 10 elements of the array splice(@Array, 0, 10); # Removes the first 10 elements of the array @NewArray = splice(@Array, 0, 10); # Removes the first 10 elements of the array and returns those 10 items splice(@Array, 0, 10, @Array2); # Replaces the first 10 elements of the array with Array2 ====See Also==== * Function reference - To remove the last element from an array * Function reference - To remove the first element from an array Any thoughts on this?