On Fri, 29 Apr 2005 00:24:49 -0700, Yitzchak Scott-Thoennes <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 28, 2005 at 03:43:24PM +0200, H.Merijn Brand wrote: > > As my example shows, if the `extension' would be accepted, in whatever > > form, I also suggest to define that each -e part gets it's own braces/ > > scope > > Yuck! Right now, each -e is considered a separate line, not scope: > > $ perl -wle'my $x=42;' -e'print $x;' -e'warn $x' > 42 > 42 at -e line 3. > > I don't want to see this changed. Then let me reword. I'd like it to be possible. lt09:/home/merijn 104 > perl -l -e 'my $x = 42' -e 'print $x' syntax error at -e line 2, near "print" Execution of -e aborted due to compilation errors. Exit 255 lt09:/home/merijn 105 > That's just because I left out the semicolon in the first -e Could we then at least agree on something that each -e is guaranteed to be closed? a lone semicolon is a no-op, so there won't be any backward compatibility issues > > > It would make a lot of command line scripts a lot easier to write. > > > Also possibe would be new switches (possibly -b and -E) for putting > > > code at the beginning or end of the script text without using a > > > BEGIN{} or END{} block. > > > > /me viciously nods: very useful! > > Is BEGIN/END so hard to type? No, but it is a lot to type in short one-liners # perl -nle'BEGIN{$s="Something"}chomp;$_ eq $s and next;%s{$s=$_}++}END {print"$_:$s{$_}" for keys%s" doesn't really read easy -- H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/) using Perl 5.6.2, 5.8.0, 5.8.5, & 5.9.2 on HP-UX 10.20, 11.00 & 11.11, AIX 4.3 & 5.2, SuSE 9.2 & 9.3, and Cygwin. http://www.cmve.net/~merijn Smoking perl: http://www.test-smoke.org, perl QA: http://qa.perl.org reports to: [EMAIL PROTECTED], perl-qa@perl.org