Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 meditating upon the Monastery: (6)
As of 2024-03-28 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found