# in 5.005_02 $x = (1,2,3)[10]; # $x is undef @x = (1,2,3)[10]; # @x is (), not (undef) @x = (undef)[0]; # @x is (), not (undef) # in 5.6.0 $x = (1,2,3)[10]; # $x is undef @x = (1,2,3)[10]; # @x is (), not (undef) @x = (undef)[0]; # @x is (undef), not () #### # returns the collapsed list: 15 chars # 123456789_12345 sub collapse {grep{defined}@_} # returns the collapsed list, via array ref: 20 chars # 123456789_123456789_ sub collapse {grep{defined}@{+pop}} # modifies array ref elements in place: 26 chars # 123456789_123456789_123456 sub collapse {@$_=grep{defined}@{$_=pop}}