]> wagnertech.de Git - mfinanz.git/blobdiff - SL/MoreCommon.pm
Funktion "listify" ergänzt.
[mfinanz.git] / SL / MoreCommon.pm
index e09d7c85dd13a236a8b45103bf0a1ee647b3a28f..6c292bab8446165cd0e8c3693c3d334e4f435e9a 100644 (file)
@@ -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;