From 67223abfdf21b3c53bbb830f223663c65b8c187b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 30 Sep 2009 12:40:42 +0200 Subject: [PATCH] =?utf8?q?Funktion=20"listify"=20erg=C3=A4nzt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Merge aus -r9498 intern. --- SL/MoreCommon.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SL/MoreCommon.pm b/SL/MoreCommon.pm index e09d7c85d..6c292bab8 100644 --- a/SL/MoreCommon.pm +++ b/SL/MoreCommon.pm @@ -4,7 +4,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(save_form restore_form compare_numbers any cross); -@EXPORT_OK = qw(ary_union ary_intersect ary_diff); +@EXPORT_OK = qw(ary_union ary_intersect ary_diff listify); use YAML; @@ -159,4 +159,10 @@ sub ary_diff { return grep { !$in_b{$_} } @$a; } +sub listify { + my @ary = scalar @_ > 1 ? @_ : ref $_[0] eq 'ARRAY' ? @{ $_[0] } : (@_); + return wantarray ? @ary : scalar @ary; +} ++ + 1; -- 2.20.1