Difference between revisions of "Python-Perl cheatsheet"

Line 32: Line 32:
 
|array length
 
|array length
 
|len(array)           
 
|len(array)           
|$#array
+
|$#array + 1
|
+
|Python returns the length of array. Perl gives me the index of the last element.
 
|-
 
|-
 
|
 
|

Revision as of 12:31, 25 April 2011


what Python Perl notes
null type None undef not exactly identical
String concatenation "py"+"thon" "pe"."rl"
declare a list [1,2,3] (1,2,3)
array length len(array) $#array + 1 Python returns the length of array. Perl gives me the index of the last element.
range(1,100) (1..100)