my @E = ([1,2], [1,3], [2,3], [2,4], [3,4]); my @nv; @nv = edges2vertices(@E); # will return: __END__ $VAR1 = [ '1', '2', '3', '4' ];