Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

  (email not shown publicly)

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm :,,
lug : Devon & Cornwall LUG
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl []
flickr :hashbangperl []

Journal of TeeJay (2309)

Monday December 18, 2006
12:10 PM

slicing and dicing with references

[ #31952 ]

A selection of hash slices and stuff for future reference..

my $x = [0,1,2,3,4,5];
print @$x[2,3]

my $array = [qw(aaa bbbb ccc ddd ee ffff ggg hhhhh)];
@$array[2..3] = (qw(ccc1 ddd2));
print @$array;

my @slice = @$hashref{ qw(a d) };

my $array = [[qw(aaa bbbb ccc ddd ee ffff ggg hhhhh)]];
@{$array->[0]}[2..3] = (qw(ccc1 ddd2));
print @{$array->[0]};'

my @array = @{$hash}{@keys};

See also :

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.