開発環境
- macOS Mojave - 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(著)、近藤 嘉雪(翻訳)、嶋田 健志(翻訳)、オライリージャパン)の13章(ディレクトリ操作)、13.4(練習問題)4の解答を求めてみる。
コード
#!/usr/bin/env perl use strict; use warnings; use utf8; use v5.18; say '4.'; unlink @ARGV;
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal)
$ ./sample4.pl *.txt
4.
$ ls
./  ../  sample4.pl*
$ touch {a,b}.txt
$ ls
./  ../  a.txt  b.txt  sample4.pl*
$ perl -e 'unlink @ARGV;' *.txt
$ ls
./  ../  sample4.pl*
$ touch {a,b}.txt
$ ls
./  ../  a.txt  b.txt  sample4.pl*
$ perl -w -e 'unlink @ARGV;' b.txt
$ ls
./  ../  a.txt  sample4.pl*
$ 
						 
0 コメント:
コメントを投稿