histogram/histogram: Auto ignore starting white space.

This commit is contained in:
Ole Tange 2013-10-21 17:39:49 +02:00
parent 69c72304d1
commit 557e70fc58

View file

@ -323,11 +323,11 @@ if(not defined $opt::input) {
} elsif(defined $delimiter) {
# guess format: (v delimiter h) or (h delimiter v)
($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 {
# guess format: v
($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;
$max_value_length = $max_header_length;
$max_value_header_length = $max_value_length + $max_header_length;
@ -469,6 +469,7 @@ sub max {
for (@_) {
# Skip undefs
defined $_ or next;
$_ eq "" and next;
defined $max or do { $max = $_; next; }; # Set $_ to the first non-undef
$max = ($max > $_) ? $max : $_;
}