my @char_list = get_separator( path => $csv_path, exclude => $array1_ref, # optional include => $array2_ref, # optional echo => 1, # optional ); my $separator; if (@char_list) { if (@char_list == 1) { # successful detection $separator = $char_list[0]; } else { # several candidates passed the tests # Some code here } else { # no candidate passed the tests # Some code here } # "I'm Feeling Lucky" alternative interface # Don't forget to include the 'lucky' parameter my $separator = get_separator( path => $csv_path, lucky => 1, exclude => $array1_ref, # optional include => $array2_ref, # optional echo => 1, # optional );