Angel Faus: > Maybe the solution is to make it hash-wise: > > %hash = @array.sep { > when /^[A-Z]*$/ {'uppercase'} > when /^[a-z]*$/ {'lowercase'} > default {'mixedcase'} > }
I agree that general partitioning is 'better' than a fixed binary proposal, but what is gained over the full code except a tiny bit of sugar? for (@array) { when /^[A-Z]+$/ { push %hash{'uppercase'}, $_ } when /^[a-z]+$/ { push %hash{'lowercase'}, $_ } default { push %hash{'mixedcase'}, $_ } } On the other hand, perhaps binary-partitioning is sufficiently common to warrant Schwern's abbreviated syntax: (@switches, @args) = separate /^-/, @ARGV; Which in full would be something like: for (@ARGV) { when /^-/ { push @switches, $_ } default { push @args, $_ } } Philip Disclaimer This communication together with any attachments transmitted with it ('this E-mail') is intended only for the use of the addressee and may contain information which is privileged and confidential. If the reader of this E-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient you are notified that any use of this E-mail is prohibited. Addressees should ensure this E-mail is checked for viruses. The Carphone Warehouse Group PLC makes no representations as regards the absence of viruses in this E-mail. If you have received this E-mail in error please notify our ISe Response Team immediately by telephone on + 44 (0)20 8896 5828 or via E-mail at [EMAIL PROTECTED] Please then immediately destroy this E-mail and any copies of it. Please feel free to visit our website: UK http://www.carphonewarehouse.com Group http://www.phonehouse.com