ssoma: use implicit $_ for simpler arg generation
authorEric Wong <e@80x24.org>
Wed, 16 Apr 2014 19:43:25 +0000 (19:43 +0000)
committerEric Wong <e@80x24.org>
Wed, 16 Apr 2014 19:43:25 +0000 (19:43 +0000)
This makes the loop shorter and judicious use of $_ is OK.

ssoma

diff --git a/ssoma b/ssoma
index c575e3df236ce252ceb917f77d43577afa128ff9..1f68f6bef33adf66b5d03418792fd39d49581e6c 100755 (executable)
--- a/ssoma
+++ b/ssoma
@@ -73,13 +73,13 @@ sub usage {
                }
 
                my $opt = $cmd{$c}->{opt} or next;
-               foreach my $s (sort keys %$opt) {
+               foreach (sort keys %$opt) {
                        # prints out arguments as they should be passed:
                        my $x = s#[:=]s$## ? '<arg>' :
                                (s#[:=]i$## ? '<num>' : '');
-                       print $fd ' ' x 21, join(', ', map { length $s > 1 ?
-                                                       "--$s" : "-$s" }
-                                               split /\|/, $s)," $x\n";
+                       print $fd ' ' x 21, join(', ', map { length $_ > 1 ?
+                                                       "--$_" : "-$_" }
+                                               split /\|/, $_)," $x\n";
                }
        }
        exit $exit;