Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Learning perlisms leads to experience, wisdom and discoveries that whitespace & idioms are lazy

by Mr. Muskrat (Canon)
on Dec 23, 2004 at 07:08 UTC ( [id://417014]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # take the values in @array and use them as a hash slice to make all o
    +f the values 1
    @hash{@array} = (1) x @array;
    
  2. or download this
    # take the values in @array and use them as keys in %hash, incrementin
    +g the values associated with said keys by one
    for (@array) { $hash{$_}++; }
    
  3. or download this
    $hash{$_}++ for (@array); # same as above only with the for at the end
    
  4. or download this
    print+map{sprintf'&#%d;',$_}unpack'C*',$_;
    
  5. or download this
    print map { sprintf '&#%d;', $_ } unpack 'C*', $string;
    
  6. or download this
    print map {
      sprintf '&#%d;', $_
    } unpack 'C*', $string;
    
  7. or download this
    $VAR1 = {
              'YZ0' => undef,
    ...
              'PQR' => undef,
              'GHI' => undef
            };
    
  8. or download this
    $VAR1 = {
              'YZ0' => 1,
    ...
              'PQR' => 1,
              'GHI' => 1
            };
    
  9. or download this
    @hash{@array} = (1 x @array);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found