Jump to content

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
m (Reverted edits by Dijkstra (talk) to last revision by GetBreak)
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:
}
}
elseelsif $license eq 'IN' {
if %licenses<count> == %licenses<max> {
%licenses<times>[*-1] ~= " through " ~ $date_time;
}
%licenses<count>--;
}
else {
# Not a licence OUT or IN event, do nothing
}
};
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.