Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Perl Weekly Challenge 206 -- oneliner

by Discipulus (Canon)
on Mar 18, 2023 at 09:55 UTC ( [id://11151052]=note: print w/replies, xml ) Need Help??


in reply to Perl Weekly Challenge 206 with List::Util

Just for fun and with many doubts on my own working solution, a nice oneliner for the first challange on time differences

perl -le "@v=sort{push@r,abs$a-$b;$a-$b}map{($h,$m)=split':',$_;$M=60* +$h+$m;($M,$M+1440,$M+2880)}@ARGV;print+(sort{$a<=>$b}@r)[0]" @ARGV = 00:00 23:55 20:00 => 5 @ARGV = 01:01 00:50 00:57 => 4 @ARGV = 10:10 09:30 09:00 09:55 => 15

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11151052]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-20 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found