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)

Friday May 21, 2004
09:40 AM

slices and references

[ #18871 ]
right I think I have sussed slices and references, so I'll put in this blog for safe keeping.

<aef> Hmm, I'm sure I can remember doing that. Now, exactly how...
<aef> perl -e '$x = [0,1,2,3,4,5]; print @$x[2,3]'
<aef> (assigning to the slice with the same syntax works)

so I try..

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


then googling to perlmonks I came across..

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


see also perldoc perllol

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.