Tuesday, December 11, 2001, 6:38:47 AM, Daniel Falkenberg wrote:
> Does any one know how I would go about deleing all hash keys with a star
> in them from the following hash?

> Would I go something like the following....

> #!/usr/bin/perl -w

> %allusers = (
>               'users' => {
>                 'user' => 'Test Account',
>                 '*Crudles' => 'Hello World',
>                 'Crud' => 'Another Test',
>                 '*test' => 'Crud User'
>                          }
>             );

> #Delete all hashs values with a * at the beginning of their value...

> delete $allusers{$users}{$all_values} if ($all_values != /^\*/);

yes, something like that should do... perhaps

  foreach my $key (keys %{$allusers{users}}) {
          next unless (substr($key, 0, 1) eq '*');

          delete $allusers{users}{$key};
  }



-- 
Best regards,
Daniel                               [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to