Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Filling buckets

by 2501 (Pilgrim)
on Jan 03, 2001 at 22:13 UTC ( [id://49579]=note: print w/replies, xml ) Need Help??


in reply to Filling buckets

these little games are always fun:)
I like perl munchies:P
If anyone would like to comment on a neater/more stylish way of handling the toggle, I would appreciate it:)
sub foo{ my @list = @_; my $toggle = 0; my (@list0,@list1); my $element; while($#list > $#list0 && $#list > $#list1 ){ if($toggle == 2){ $toggle = 0; next; }else{ $element = pop(@list); if($toggle ==1){ push(@list1,$element); }else{ push(@list0,$element); } # end of else toggle == 1 $toggle++; } #end of else toggle == 2 } #end of while return \@list, \@list0, \@list1; } # end of sub;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://49579]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-26 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found