Gunnar Hjalmarsson wrote:
Edward WIJAYA wrote:

Just thought whether it is possible to do
it with "map" function? Make it into one-liner?


It is.

    my %myNEWhash =
      map { $_, delete $myhash{$_} } grep /^1\D/, keys %myhash;

Very good Gunnar! But the regexp may not work in all cases.

my %myNEWhash = map { $_, delete $myhash{$_} } grep /^1(?:\D|$)/, keys %myhash;


John -- use Perl; program fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to