LoginSignup
8
8

More than 5 years have passed since last update.

perl コマンドラインオプション -s

Posted at

perlの起動オプションに -s(switchオプション) をつけとくと それが変数でとれるようになる
例えば-XXX=ZZZ や -YYY といった引数をスクリプト内で変数として使えます。便利ですね。

#!/usr/bin/perl -s

# 普通に考えると定義してない変数2つ使ってるからうごかん
print $unko if $shif;
# しかしyesyes!
$ ./switch.pl -unko="yesyes!" -shit
yesyes!
8
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8