Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

kennethk's scratchpad

by kennethk (Monsignor)
on Sep 18, 2008 at 19:23 UTC ( #712373=scratchpad: print w/ replies, xml ) Need Help??

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @data = ( {unit => 'S', value => 50, }, {unit => 'T', value => 60, }, {unit => 'Q', value => 70, }, ); # Works LOCAL_BLOCK_1: { local $data[0]{unit} = 'S'; local $data[1]{unit} = 'S'; local $data[2]{unit} = 'S'; print Dumper \@data; } # Doesn't work LOCAL_BLOCK_2: { local $data[$_]{unit} = 'S' for 0 .. $#data; print Dumper \@data; } # Doesn't work LOCAL_BLOCK_3: { local $_->{unit} = 'S' for @data; print Dumper \@data; } ## Doesn't work, fatal #LOCAL_BLOCK_4: { # local map {$_->{unit}} @data; # $_->{unit} = 'S' for @data; # # print Dumper \@data; #} print Dumper \@data;
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-08-02 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls