in reply to Re^2: string? Or binary garbage?
in thread string? Or binary garbage?

Well, I fixed the problem myself. In my previous example, I had:

$a !~ /\p{IsPrint}/

which tests whether $a does NOT match any printing characters. (In other words, the test fails if it DOES match a PRINTABLE character.) So, what I wanted to do is close, but not quite the same thing:

$a =~ /\P{IsPrint}/
which basically tests "does $a match the compliment of a printing character?" In other words, "are there ANY non-printing characters here?"

One has to look really closely and speak out the logic into a dark empty room before knowing intuitively which was the right choice ahead of time.

Replies are listed 'Best First'.
Re^4: string? Or binary garbage?
by hakkr (Chaplain) on Dec 01, 2004 at 15:55 UTC
    could you use unpack to do this as well?

    i.e try and unpack some binary string data and see if it works ..