Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by jch341277 (Sexton)
on Aug 09, 2005 at 18:36 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-09-13 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (17 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.