http://qs1969.pair.com?node_id=35133


in reply to regexp's

Well, this is one way: foreach (@array) { my ($key,$val); /\w+$/ and $key = $&; /^\d+/ and $val = $&; $hash{$key} = $val; } This will slow down all your pattern matches because of using $&. The alternative, if you don't use $& or similar variables elsewhere, would be $key = $_; $val = $_; and then some kind of substitution. It also assumes that numbers are always,er, numbers and the names are always one word. If not, you could use \b for boundary-matching dave