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 about the Monastery: (4)
As of 2018-07-18 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (393 votes). Check out past polls.

    Notices?