X-Original-To: [EMAIL PROTECTED]
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
X-Spam-Status: No, hits=0.0 required=7.0
tests=
X-Spam-Check-By: la.mx.develooper.com
X-Authenticated: #163624
Date: Sun, 11 Apr 2004 03:56:16 +0200
From: "A. Pagaltzis" <[EMAIL PROTECTED]>
Mail-Followup-To: [EMAIL PROTECTED]
Content-Disposition: inline
* Etienne Grossmann <[EMAIL PROTECTED]> [2004-04-11 03:19]:
> On Sat, Apr 10, 2004 at 08:56:26PM -0400, [EMAIL PROTECTED] wrote:
> > last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
> > That's gonna be tough for Randal to beat... :-)
> > -- Larry Wall in <[EMAIL PROTECTED]>
>
> The other conditions in the rhs I don't grok.
Remember that it's shell code at the first iteration here, and as
there's single-quotes in the middle of the Perl code, only the
following bits are seen verbatim by Perl:
perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^
The rest is interpreted by the shell -- particularly, the $1 and
$2 not protected by anything are interpolated before Perl is even
called.
With a little spacing, the code reads like this:
$_ x= /(..:..)...(.*)/ && 'foo' ge $1 && 'bar' lt $2;
where I'm assuming that the shell's $1 was "foo" and its $2 was
'bar'.
I see. But I think you meant
$_ x= /(..:..)...(.*)/ && 'foo' ge $1 && 'foo' lt $2;
since the shell's $2 is never used, as far as I can tell. I still
have no clue what the shell's $1 would be in this case, other than the
empty string.
kj