Text processing/2: Difference between revisions

m
→‎{{header|Sidef}}: modified the code to work with the latest version of Sidef
m (→‎{{header|Sidef}}: added an warning for invalid lines)
m (→‎{{header|Sidef}}: modified the code to work with the latest version of Sidef)
Line 2,543:
{{trans|Perl 6}}
<lang ruby>var good_records = 0;
var dates = Hash.new -> default(0);
 
ARGF.each { |line|
linevar m ~~= /^(\d\d\d\d-\d\d-\d\d)((?:\h+\d+\.\d+\h+-?\d+){24})\s*$/.match(line);
m || (warn "Bad format at line #{$.}"; next);
dates{m[$10]} := 0 ++;
var i = 0;
$2m[1].words.all{|n| i++ .is_even || (n.to_num >= 1) } && good_records++good_records;
}
 
2,747

edits