[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



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:
> > > >> ($p,$q) = ($q,$p);
> > > >
> > > > That's highly obfuscated. Are you sure you want it in maintainable 
> code?
> > > >
> > >
> > > Actaully the second one isn't that obfuscated.
> >
> > <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? :)

(I'll feel really stupid if I'm wrong, since I sit next to Jeffrey Friedl 
at work *grin*)

D

[1] He wrote that ORA "Mastering Regular Expressions" book and if I made a 
dumbass mistake he'll make me read a chapter of his book and quiz me on it. :)



==== 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

</x-flowed>