Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Syntactic Confectionery Delight
 
PerlMonks  

tangent's scratchpad

by tangent (Chaplain)
on May 18, 2011 at 02:41 UTC ( #905404=scratchpad: print w/ replies, xml ) Need Help??

my @sequences; while (%g) { # pick a start point my $last = (keys %g)[0]; my $hash = delete $g{$last}; my @keys = keys %$hash; # only two keys my $start = $keys[0]; my $current = $keys[1]; my @sequence = ($start,$last,$current); while (my $h = delete $g{$current}) { my @k = keys %$h; if ($k[0] ne $last) { $last = $current; $current = $k[0]; push(@sequence,$current); } else { $last = $current; $current = $k[1]; push(@sequence,$current); } if ($current eq $start) { # we have reached the end of this sequence cycle delete $g{$current}; last; } } push(@sequences,\@sequence); }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2014-04-16 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (436 votes), past polls