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

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -