Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: popping, shifting or splicing an array???

by jch341277 (Sexton)
on Aug 09, 2005 at 18:36 UTC ( #482362=note: print w/replies, xml ) Need Help??


in reply to popping, shifting or splicing an array???

I know that this doesn't technically answer your question - but wouldn't this be easier using a hash?

use strict; my %h = (); $h{$_}=1 for (0 .. 100); while(1) { print "choose a number: " . join(",",sort { $a <=> $b } keys %h,"q") . "\n"; my $in = <STDIN>; chomp $in; if ($in eq "q") { last; } delete $h{$in}; } print "remaining: " . join(",", sort { $a <=> $b } keys %h) . "\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://482362]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-12-17 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (462 votes). Check out past polls.

    Notices?