concatenation - perl parsing command-line arguments -


i need write perl program accept command lines arguments can concatenated e.g.

myperl.pl -l -c -d    same    myperl.pl  -lcd 

the constrains couldn't use build in modules such "getopts", know of else realize easily.

i agree, should use modules. anyway, here's 1 attempt can build upon:

use strict; use warnings; @opts = grep /^-\w+/, @argv; print "(1) @opts\n" if @opts; @normalized = sort grep /\w/, map { split /(-|)/ } @opts; print "(2) @normalized\n" if @normalized; 

Comments

Popular posts from this blog

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -