開発環境
- macOS Catalina - Apple (OS)
- Emacs (Text Editor)
- Windows 10 Pro (OS)
- Strawberry Perl (WindowsのPerlの言語処理系)
- Visual Studio Code (Text Editor)
- Perl 5.28 (プログラミング言語)
初めてのPerl 第7版 (Randal L. Schwartz(著)、brian d foy(著)、Tom Phoenix(著)、近藤 嘉雪(翻訳)、嶋田 健志(翻訳)、オライリージャパン)の16章(上級テクニック)、16.6(練習問題)2の解答を求めてみる。
コード
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use v5.18;
use Encode::Locale;
binmode STDIN, ':encoding(console_in)';
binmode STDOUT, ':encoding(console_out)';
binmode STDERR, ':encoding(console_out)';
say '2.';
chdir '/usr/';
for (<* .*>) {
my ($atime, $mtime) = (stat $_)[8, 9];
next unless $atime;
printf "%-20s %10d %10d\n", $_, $atime, $mtime;
}
入出力結果(Zsh、cmd.exe(コマンドプロンプト)、Terminal)
% ./sample2.pl 2. bin 1569788922 1571763399 lib 1569788922 1571763578 libexec 1569788922 1571763399 local 1571763418 1571763546 sbin 1569788922 1570493289 share 1569788667 1570493289 standalone 1569788590 1569788590 . 1569788586 1570493289 .. 1571763661 1571763403 %
0 コメント:
コメントを投稿