Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Testing if an array contains a value and then deleting it in most efficient way

by ikegami (Patriarch)
on Feb 18, 2008 at 16:37 UTC ( [id://668599]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Testing if an array contains a value and then deleting it in most efficient way
in thread Testing if an array contains a value and then deleting it in most efficient way

Fortunately for you, deleting the first (or last) element of an array (shift(@a)) is very fast (O(1)) in Perl.
  • Comment on Re^3: Testing if an array contains a value and then deleting it in most efficient way
  • Download Code

Replies are listed 'Best First'.
Re^4: Testing if an array contains a value and then deleting it in most efficient way
by karpatov (Beadle) on Feb 18, 2008 at 16:45 UTC
    There is one problem though, the values to be check against the array come from a db which is splitted into several files, so their names something0001,something1000 should be ordered but @files = sort { $a <=> $b } @files causes the IDE to freeze. What can be wrong? tx.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://668599]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-26 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found