in reply to using join with a print ref statement

The ref function applies to its arg. In this case, the C<join> is passing a string to C<ref>: which returns a null (undef) value. So nothing is printed.

You probably want something like:

print join(":", @$result) if ref $result;
If you wish to use the ?: notations, then
print ref($result) ? join(":", @$result) : "no results";
--Dave

Update: "?:" example fixed per ihb's response

Replies are listed 'Best First'.
Re: Re: using join with a print ref statement
by ihb (Deacon) on Jan 20, 2003 at 19:06 UTC
    print (ref $result) ? (join ":", @$result) : "no results";

    "I looks like a function, hence it is a function." That will parse as   (print(ref $result)) ? (join ":", @$result) : "no results"; You need to disambiguate with a +:   print +(ref $result) ? (join ":", @$result) : "no results"; But I don't understand what's wrong with   print ref($result) ? (join ":", @$result) : "no results"; or for that matter,   print ref $result ? (join ":", @$result) : "no results"; either. Since that will actually parse the intended way.

    ihb
      Duh! You're right, I was careless. --Dave