Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

kennethk's scratchpad

by kennethk (Abbot)
on Sep 18, 2008 at 19:23 UTC ( [id://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
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-28 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found