zumbabumba
Technical User
Hi all. Is there any efficient way to sort arrays ignoring square brackets and/or other characters? Suppose you have:
@names = ('[Ca]rl', 'Bil[l]y', 'Alan');
I want the output of sort @names be: Alan Bil[l]y [Ca]rl. The standard sort outputs [Ca]rl Alan Bil[l]y beacuse square brackets come first in alphabetical order. By now I thought I can copy the names having square brackets in them, remove brackets, sort them, and replace those having brackets, but I guess this is not the perlistic way.
@names = ('[Ca]rl', 'Bil[l]y', 'Alan');
I want the output of sort @names be: Alan Bil[l]y [Ca]rl. The standard sort outputs [Ca]rl Alan Bil[l]y beacuse square brackets come first in alphabetical order. By now I thought I can copy the names having square brackets in them, remove brackets, sort them, and replace those having brackets, but I guess this is not the perlistic way.