Text processing/Max licenses in use: Difference between revisions
m
→{{header|Perl 6}}: Add some error trapping as recommended by Dijkstra. No change to output
Thundergnat (talk | contribs) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Add some error trapping as recommended by Dijkstra. No change to output) |
||
Line 1,750:
=={{header|Perl 6}}==
Add some error trapping as recommended by [[Dijkstra]]. Not particularly necessary for this specific example but it doesn't hurt to be proactive.
Redirecting the mlijobs.txt file to STDIN:
<lang perl6>my %licenses;
Line 1,755 ⟶ 1,758:
%licenses<count max> = 0,0;
for $*IN.lines -> $line {
my ( $license, $date_time );
( *, $license, *, $date_time ) = split /\s+/, $line;
Line 1,768 ⟶ 1,771:
}
}
if %licenses<count> == %licenses<max> {
%licenses<times>[*-1] ~= " through " ~ $date_time;
}
%licenses<count>--;
}
else {
# Not a licence OUT or IN event, do nothing
}
};
|