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
Post a Comment