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

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



Bek Oberin wrote:
>
> That makes sense but can somebody explain how
> 
> > At 10:16 PM 6/10/99 -0500, Tushar Samant wrote:
> > >    $q^=$p^=$q^=$p
> 
> is  parsed?

Easy. Just right to left. Equivalent multiline version:

 $q ^= $p;
 $p ^= $q;
 $q ^= $p;

BTW, why does this work with strings of different length?
Deep Perl magic?

(puzzled)

Roland
--
perl -e '@_=@ARGV;$_="@_[-3,-2,-1]";s{([@{[$_[-1]]}])}#($0=$1.
${[qw[>$%, ()%{&", &"=, |}+&" *]]}[$@++])=~y/*=->$%&"(-){-}+,/
lusternohack /,$0#eg; print; '        -- Roland Giersig, JAPH.

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