[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [Fun With Perl] How to swap $p and $q without $tmp



On Sun, Jun 13, 1999 at 04:03:54AM -0400, mjd-perl-@plover.com wrote:
> 
> > On Sun, Jun 13, 1999 at 12:28:19AM -0700, Derek Balling wrote:
> > > At 02:49 AM 6/13/99 -0400, David H. Adler wrote:
> > > >On Sat, Jun 12, 1999 at 01:06:32AM -0400, mjd-list-fwp@plover.com wrote:
> > > > > <foghorn>It's a joke, son.</foghorn>
> > > >
> > > >s/It's/$1, I say, $1/
> > > 
> > > I truly believe you wanted :
> > > 
> > > s/(It's)/\1, I say, \1/
> > > 
> > > There. Didn't you?
> > > 
> > > Or did I miss something in the way regexes work? :)
> > 
> > Nope, I'm just tired.  :-)
> 
> They both work.  But some people say it's better to use the $1
> variables on the right-hand side of a subtitution for a couple of
> reasons:

Yikes.  I must have been tired... I just noticed the parens...

Granted, I really did mean $1, but surely mine *doesn't* work, due to
my sleep-deprivation-induced lack of parens?

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
i gave up on every non-perl language because I had too much real work
to do and it [perl] came into my life and painted pretty flowers all
over my walls
	-Peter Fagan

==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org