Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use utf8;
- use open qw(:std :encoding(utf8));
- use DateTime::Format::Strptime q(strptime);
- my @plans = <DATA>;
- print for @plans;
- print "--\n";
- my @sorted = map { $$_[1] } sort { $$a[0] <=> $$b[0] } map {
- /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d/;
- [strptime('%F %T', $&)->epoch, $_]
- } grep { /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d/ } @plans;
- print for @sorted;
- __DATA__
- 場所=東京 時間=2018-12-25 10:00:00 持ち物=携帯電話
- 場所=千葉 時間=2018-12-18 16:00:00 持ち物=携帯電話
- 場所=埼玉 時間=2018-12-09 12:00:00 持ち物=携帯電話
- 場所=群馬 時間=2018-12-31 09:00:00 持ち物=携帯電話
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement