in reply to Re:(5): Perl Internals - references and symbol table
in thread Perl Internals - references and symbol table
I don't suppose this satisfies your criteria? It works, but would screw up if you tried to nest uses of it.
#! perl -sw use strict; { my $next=0; sub elements(\@$) { my ($ref, $count) = @_; my $max = $#$ref; $next=0, return if $next > $max; my $first = $next; my $last = $next+$count-1; $last = $max if $max < $last; $next += $count; @{$ref}[$first .. $last]; } } my @letters = ('a'..'z'); while(my @els = elements(@letters, 5) ) { print "@els\n"; } __END__ a b c d e f g h i j k l m n o p q r s t u v w x y z
Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re:(5): Perl Internals - references and symbol table
by shotgunefx (Parson) on Nov 20, 2002 at 05:21 UTC | |
by BrowserUk (Patriarch) on Nov 20, 2002 at 05:56 UTC |