in reply to Testing a string for a range of characters

In addition, if you're really worried this much about performance, your hash creation could be simplified:
my %hash; @hash{'A'..'Z'} = (); ... if (exists $hash{$whatever}) { ... }

Replies are listed 'Best First'.
Re: Re: Testing a string for a range of characters
by BoredByPolitics (Scribe) on Jan 24, 2001 at 21:02 UTC
    Aha! That's what tilly had suggested, but without the my %hash; first, and I was getting confused when trying to combine the my and assignment in the same statment! Thanks Fastolfe, I'd not seen that particular usage before :-)

    As regards your other reply, currently I'm shifting off the first element of the array, which tells me what the record type is. I then join the array with a delimiter for writing out to a flat file, minus the transaction type (or rather the transaction type get's built into the key I insert with the join).

    Pete