Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Using constants as hash keys

by choroba (Cardinal)
on Jan 04, 2018 at 19:03 UTC ( [id://1206712]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use constant A => 12;
    my %hash = ( (A) => 'twelve' ); # beautiful
    
  2. or download this
    m=Deparse
    diff <(perl -MO=$m -e 'use constant A => 12; my %hash = ( A() => "twel
    +ve")') \
         <(perl -MO=$m -e 'use constant A => 12; my %hash = ( (A) => "twel
    +ve")')
    
  3. or download this
    m=Terse
    diff <(perl -MO=$m -e 'use constant A => 12; my %hash = ( A() => "twel
    +ve")' \
           | perl -pe 's/0x\w+/X/g') \
         <(perl -MO=$m -e 'use constant A => 12; my %hash = ( (A) => "twel
    +ve")' \
           | perl -pe 's/0x\w+/X/g')
    
  4. or download this
    m=Concise
    diff <(perl -MO=$m -e 'use constant A => 12; my %hash = ( A() => "twel
    +ve")') \
    ...
    < 4           <$> const[IV 12] s*/FOLD ->5
    ---
    > 4           <$> const[IV 12] sP*/FOLD ->5
    
  5. or download this
    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
    }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1206712]
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-29 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found