Stories
Slash Boxes
Comments
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)

TeeJay
  (email not shown publicly)
http://www.aarontrevena.co.uk/

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm : london.pm, bath.pm, devoncornwall.pm
lug : Devon & Cornwall LUG
CPAN : TEEJAY [cpan.org]
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl [livejournal.com]
flickr :hashbangperl [flickr.com]

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 :

http://perldoc.perl.org/perlcheat.html

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