in reply to String or array?

$user->{'host'} = [ '*' ]; # An array of one item

Replies are listed 'Best First'.
Re^2: String or array?
by sschneid (Deacon) on Sep 15, 2005 at 18:54 UTC
    Yeah... the problem is (maybe I should have specified) that what's put in $user->{'host'} isn't defined by me explicitly -- depending on what the query returns, it's either a string or an array. I need to act on what's given.

    -s.

      I figured out what you meant just before you posted. I was about to update my post with the following when your reply appeared:

      my ($user); $user->{'host'} = '*'; $user->{'host'} = [ $user->{'host'} ] if not ref $user->{'host'};

      ref

        Worked. Thanks yo.

        -s.