On Sun, 1 May 2005, Abigail wrote:

> On Fri, Apr 29, 2005 at 12:24:49AM -0700, Yitzchak Scott-Thoennes wrote:
> >
> > Is BEGIN/END so hard to type?
>
> It's not. But if "not hard to type" was a reason to leave something
> out, we wouldn't have -p, -n, -a, -F, -M, -l, -s or -I.
>
> Nor wouldn't we have a million functions that have optional arguments.
>
> In fact, if that was a reason, we wouldn't have Perl. We'd still use C.
>
> Abigail

Can I assume that the difference in the synopses in perl and perlrun
is not intentional?

% perldoc perl
...
SYNOPSIS
     perl [ -sTuU ] [ -hv ] [ -V[:configvar] ]
         [ -cw ] [ -d[:debugger] ] [ -D[number/list] ]
         [ -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal] ]
         [ -Idir ] [ -m[-]module ] [ -M[-]'module...' ]
         [ -P ] [ -S ] [ -x[dir] ]
         [ -i[extension] ]
     [ -e 'command' ] [ -- ] [ programfile ] [ argument ]...
...
perl v5.8.6          Last change: 2005-01-21                    9


% perldoc perlrun
...
SYNOPSIS
     perl [ -sTtuUWX ]      [ -hv ] [ -V[:configvar] ]
          [ -cw ] [ -d[t][:debugger] ] [ -D[number/list] ]
          [ -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal/hexadecimal]
]
          [ -Idir ] [ -m[-]module ] [ -M[-]'module...' ]
          [ -P ]      [ -S ]      [ -x[dir] ]
          [ -i[extension] ]
          [ -e 'command' ] [ -- ] [ programfile ] [ argument ]...
          [ -C [number/list] ] ]>
...
perl v5.8.6          Last change: 2005-01-21                   25

I mention this because of the suggestion to use -X, which is
apparently already in use.  The following apparently are not already
in use:

b f g j k n o q r y z
A B E G H J K L N O Q R Y Z
1 2 3 4 5 6 7 8 9

Of these, none stands out to me as an obvious choice for the kinds of
uses that have been suggested.  Would overloading -e with a single
letter be too dangerous?

-eB '...'  ===  -e 'BEGIN{...}'
-eE '...'  ===  -e 'END{...}'
-eC '...'  ===  -e 'CHECK{...}' (?)
-eI '...'  ===  -e 'INIT{...}'  (?)
-eb '...'  ===  -e '...' but before the implicit while loop
-ee '...'  ===  -e '...' but after the implicit while loop

Regards,

Brad

Reply via email to