開発環境
- macOS Mojave - Apple (OS)
- Emacs (Text Editor)
- Windows 10 Pro (OS)
- Strawberry Perl (WindowsのPerlの言語処理系)
- Visual Studio Code (Text Editor)
- Perl 5.30 (プログラミング言語)
続・初めてのPerl 改訂第2版 (Randal L. Schwartz(著)、brian d foy(著)、Tom Phoenix(著)、伊藤 直也(監修)、長尾 高弘(翻訳)、オライリージャパン)の3章(中級者の基礎知識)、3.5(練習問題)1の解答を求めてみる。
コード
#!/usr/bin/env perl
use strict;
use warnings;
use v5.30;
say '1.';
print map { " " x 4 . $_ . "\n"} grep { -s $_ < 1000} @ARGV;
入出力結果(Zsh、PowerShell、Terminal)
% ./sample1.pl
1.
% ./sample1.pl /etc/*
1.
/etc/afpovertcp.cfg
/etc/afpovertcp.cfg~orig
/etc/apache2
/etc/asl
/etc/auto_home
/etc/auto_master
/etc/auto_master~orig
/etc/bashrc
/etc/bashrc~previous
/etc/bootpd.plist
/etc/com.apple.screensharing.agent.launchd
/etc/csh.cshrc
/etc/csh.cshrc~orig
/etc/csh.login
/etc/csh.login~orig
/etc/csh.logout
/etc/csh.logout~orig
/etc/cups
/etc/defaults
/etc/emond.d
/etc/find.codes
/etc/find.codes~orig
/etc/fstab.hd
/etc/fstab.hd~previous
/etc/ftpusers
/etc/ftpusers~orig
/etc/hosts
/etc/hosts.equiv
/etc/hosts~orig
/etc/kern_loader.conf
/etc/kern_loader.conf~previous
/etc/localtime
/etc/locate.rc
/etc/mail.rc
/etc/mail.rc~orig
/etc/manpaths
/etc/manpaths.d
/etc/nanorc
/etc/networks
/etc/networks~orig
/etc/newsyslog.d
/etc/nfs.conf
/etc/nfs.conf~orig
/etc/notify.conf
/etc/ntp.conf
/etc/ntp_opendirectory.conf
/etc/openldap
/etc/pam.d
/etc/paths
/etc/paths.d
/etc/paths~orig
/etc/periodic
/etc/pf.anchors
/etc/php-fpm.d
/etc/ppp
/etc/profile
/etc/profile~orig
/etc/racoon
/etc/resolv.conf
/etc/rmtab
/etc/rtadvd.conf
/etc/rtadvd.conf~previous
/etc/security
/etc/shells
/etc/shells~orig
/etc/snmp
/etc/ssh
/etc/ssl
/etc/sudo_lecture
/etc/sudoers.d
/etc/syslog.conf
/etc/syslog.conf~previous
/etc/thnuclnt
/etc/wfs
/etc/xtab
/etc/zprofile
/etc/zshrc_Apple_Terminal
% perl -w -e 'print map{" $_\n"}grep{-s $_ <1000}@ARGV' /etc/*
/etc/afpovertcp.cfg
/etc/afpovertcp.cfg~orig
/etc/apache2
/etc/asl
/etc/auto_home
/etc/auto_master
/etc/auto_master~orig
/etc/bashrc
/etc/bashrc~previous
/etc/bootpd.plist
/etc/com.apple.screensharing.agent.launchd
/etc/csh.cshrc
/etc/csh.cshrc~orig
/etc/csh.login
/etc/csh.login~orig
/etc/csh.logout
/etc/csh.logout~orig
/etc/cups
/etc/defaults
/etc/emond.d
/etc/find.codes
/etc/find.codes~orig
/etc/fstab.hd
/etc/fstab.hd~previous
/etc/ftpusers
/etc/ftpusers~orig
/etc/hosts
/etc/hosts.equiv
/etc/hosts~orig
/etc/kern_loader.conf
/etc/kern_loader.conf~previous
/etc/localtime
/etc/locate.rc
/etc/mail.rc
/etc/mail.rc~orig
/etc/manpaths
/etc/manpaths.d
/etc/nanorc
/etc/networks
/etc/networks~orig
/etc/newsyslog.d
/etc/nfs.conf
/etc/nfs.conf~orig
/etc/notify.conf
/etc/ntp.conf
/etc/ntp_opendirectory.conf
/etc/openldap
/etc/pam.d
/etc/paths
/etc/paths.d
/etc/paths~orig
/etc/periodic
/etc/pf.anchors
/etc/php-fpm.d
/etc/ppp
/etc/profile
/etc/profile~orig
/etc/racoon
/etc/resolv.conf
/etc/rmtab
/etc/rtadvd.conf
/etc/rtadvd.conf~previous
/etc/security
/etc/shells
/etc/shells~orig
/etc/snmp
/etc/ssh
/etc/ssl
/etc/sudo_lecture
/etc/sudoers.d
/etc/syslog.conf
/etc/syslog.conf~previous
/etc/thnuclnt
/etc/wfs
/etc/xtab
/etc/zprofile
/etc/zshrc_Apple_Terminal
%
0 コメント:
コメントを投稿