Scalar || List context

Posted by root Tue, 12 Feb 2008 20:12:00 GMT

Perl
 $a  = ("a", "b", "c"); # $a is "c" - the last element
($a) = ("a", "b", "c"); # $a is "a" - the first element
Ruby
 obj        = ["a", "b", "c"] # obj is Array - ["a", "b", "c"]
 obj, b, c = ["a", "b", "c"] # obj is String - "a"

Posted in , ,  | no comments

Comments

Comments are disabled