Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Testing a string for a range of characters

by Fastolfe (Vicar)
on Jan 24, 2001 at 20:10 UTC ( [id://54013]=note: print w/replies, xml ) Need Help??


in reply to Testing a string for a range of characters

It might also pay to ask yourself, "How many times will this test be repeated?" If it's just once, I might suggest that you move your hash creation into your benchmark test, as I suspect the expense involved in the construction of the hash will make the other methods a bit more appealing. If your test will be repeated dozens or more times on the same range, a hash is clearly the better way to approach it.
  • Comment on Re: Testing a string for a range of characters

Replies are listed 'Best First'.
Re: Re: Testing a string for a range of characters
by BoredByPolitics (Scribe) on Jan 24, 2001 at 20:25 UTC
    The test will be repeated possibly thousands of times, as records are read in from an array, but I agree, if it was only going to be a one off, then I'd probably have left it as a regex.

    Pete

      If you're reading these in from an array, I wonder if a test like this might be faster:
      my @array = get_block_of_data; data_is_bad if join("", @array) =~ /[^A-Z]/;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-25 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found