histogram/histogram: Auto ignore starting white space.
This commit is contained in:
parent
69c72304d1
commit
557e70fc58
|
@ -323,11 +323,11 @@ if(not defined $opt::input) {
|
||||||
} elsif(defined $delimiter) {
|
} elsif(defined $delimiter) {
|
||||||
# guess format: (v delimiter h) or (h delimiter v)
|
# guess format: (v delimiter h) or (h delimiter v)
|
||||||
($max_value_length, $max_header_length, $max_value_header_length, $header_ref, $value_ref) =
|
($max_value_length, $max_header_length, $max_value_header_length, $header_ref, $value_ref) =
|
||||||
parse_raw_given_opt_input("v".$delimiter."h",@raw);
|
parse_raw_given_opt_input('\s*v'.$delimiter."h",@raw);
|
||||||
} else {
|
} else {
|
||||||
# guess format: v
|
# guess format: v
|
||||||
($max_value_length, $max_header_length, $max_value_header_length, $header_ref, $value_ref) =
|
($max_value_length, $max_header_length, $max_value_header_length, $header_ref, $value_ref) =
|
||||||
parse_raw_given_opt_input("v",@raw);
|
parse_raw_given_opt_input('\s*v',@raw);
|
||||||
$header_ref = $value_ref;
|
$header_ref = $value_ref;
|
||||||
$max_value_length = $max_header_length;
|
$max_value_length = $max_header_length;
|
||||||
$max_value_header_length = $max_value_length + $max_header_length;
|
$max_value_header_length = $max_value_length + $max_header_length;
|
||||||
|
@ -469,7 +469,8 @@ sub max {
|
||||||
for (@_) {
|
for (@_) {
|
||||||
# Skip undefs
|
# Skip undefs
|
||||||
defined $_ or next;
|
defined $_ or next;
|
||||||
defined $max or do { $max = $_; next; }; # Set $_ to the first non-undef
|
$_ eq "" and next;
|
||||||
|
defined $max or do { $max = $_; next; }; # Set $_ to the first non-undef
|
||||||
$max = ($max > $_) ? $max : $_;
|
$max = ($max > $_) ? $max : $_;
|
||||||
}
|
}
|
||||||
return $max;
|
return $max;
|
||||||
|
|
Loading…
Reference in a new issue