Just looking at ways to handle cmdline arguments. I know about getopts but I found this snippet in programming perl book and wanted to understand better what it is doing.
Probably horribly obvious I guess but what is the s/// operator (s/^-(?=.)//) in the `ARG:' line doing here: Also not sure of the significance of ARG: and OPT: labels. (I mean how it would differ without them) ARG: while (@ARGV && $ARGV[0] =~ s/^-(?=.)//) { OPT: for (shift @ARGV) { m/^$/ && do { next ARG; }; m/^-$/ && do { last ARG; }; s/^d// && do { $Debug_Level++; redo OPT; }; s/^l// && do { $Generate_Listing++; redo OPT; }; s/^i(.*)// && do { $In_Place = $1 || ".bak"; next ARG; }; say_usage("Unknown option: $_"); } } Including the brief explanation from Programming perl (Third Ed.) Here's an example from a real program that uses all three loop-control operators. Although this particular strategy of parsing command-line arguments is less common now that we have the Getopts::* modules bundled with Perl, it's still a nice illustration of the use of loop-control operators on named, nested loops: -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/