And there's a trick, too! (Sorry, I'm a bit drunk. I apologize if I find this funnier than you sober folk.) %h=(m=>1=>n=>2=>o=>3=>)=>@h{m,n,o}=(4,5,6)=>print%h Hint: %h=(m=>1=>n=>2=>o=>3=>)=>@h{m..o}=(4,5,6)=>print%h

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
(crazyinsomniac) Re: Hashes are fun!
by crazyinsomniac (Prior) on Dec 16, 2001 at 14:31 UTC
    In an effort to help the obfu scene newcomers, here is one tip:
    >more f %h=(m=>1=>n=>2=>o=>3=>)=>@h{m,n,o}=(4,5,6)=>print%h >perl -MO=Deparse f %h = ('m', 1, 'n', 2, 'o', 3), @h{/n/o} = (4, 5, 6), print(%h); f syntax OK >perl -w f Use of uninitialized value in pattern match (m//) at f line 1. m1n2o3

     
    ___crazyinsomniac_______________________________________
    Disclaimer: Don't blame. It came from inside the void

    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Re: Hashes are fun!
by Jazz (Curate) on Dec 16, 2001 at 12:20 UTC

    It looks like the @h{m,n,o} is using , as a regex delimiter (sneaky). It broke when trying to reformat for legibility.

    %h = ( m=>1, n=>2, o=>3, ); # yields bareword error on 'o'; @h{ m, n, o } = ( 4, 5, 6 ); # yields m4n5o6 @h{ 'm', 'n', 'o' } = ( 4, 5, 6 ); # both yield m1n2o3 @h{ m,n,o } = ( 4, 5, 6 ); @h{ m|n|o } = ( 4, 5, 6 );

    The hash slice is using a regex on nothing (undefined value). Of course there's no match so no new key can be generated and existing key values aren't changed.

Re: Hashes are fun!
by belg4mit (Prior) on Dec 16, 2001 at 08:32 UTC
    I am failing to undertsand...
    %h=(m=>1=>n=>2=>o=>3=>)=>@h{m..o}=(4,5,6)=>print%h %h=(m=>1=>n=>2=>o=>3=>),@h{m..o}=(4,5,6),print%h %h=(m=>1=>n=>2=>o=>3=>);@h{m..o}=(4,5,6);print%h %h=(m=>1=>n=>2=>o=>3=>);print%h
    All of which give your output of m1n2o3

    --
    perl -p -e "s/(?:\w);([st])/'\$1/mg"

      Wouldn't you expect them to have the values 4, 5, and 6?! And how dare you run Perl code without warnings on. Honestly!

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

        I would, but didn't see that as humorous. Nor the trick :-P. As for warnings you didn't indicate that this obfu was compatible with such ;-)!

        --
        perl -p -e "s/(?:\w);([st])/'\$1/mg"