in reply to Re2: Sorting data pullled in by DBI
in thread Sorting data pulled in by DBI

The problem with !$_ (and jeffa's map example), is that it tests for truth, so you also end up substituting any values that match 0 instead of only those that are undef.

Perhaps you meant to use !defined instead?

    --k.


  • Comment on Re: Re2: Sorting data pullled in by DBI

Replies are listed 'Best First'.
Re4: Sorting data pullled in by DBI
by blakem (Monsignor) on Mar 18, 2002 at 03:46 UTC
    Yes, !defined is probably a better CONDITON for the original data... I was merely refactoring the given map code. However, since you probably want the empty string to be defaulted as well, I'd probably use something like:
    $_ = ' ' for grep {!defined or $_ eq ''} @arr;

    -Blake