in reply to What is the function that does the following..?

I am not sure exactly what your end goal is.

In Perl regex'es the \s stands for any whitespace character (space,\n,\r,\f,\t). \s* would mean zero or more of these and \s+ would mean at least one of these and possibly more of them. \s is an easy "short hand" for any of these "non-printable" space characters.

It could very well be that as other posters have suggested that the problem lies with 16 bit vs 8 bit chars. But then again, perhaps not if the issue is just "blank space" characters vs some other character.

Consider the following code. Common function names are: isprint() or isprintable() for a yes/no value. Below my sub get_printable() always returns something.

#!/usr/bin/perl -w use strict; my $var = "Some random text.\n\tMore\n\tEven More.\n\r\t And yet More +."; print "VAR is:$var\n"; print "Output of loop:\n"; foreach my $char (split//,$var) { print get_printable($char); } print "\n"; sub get_printable { my $char = shift; return $char if ($char =~ tr/A-Za-z0-9. //); return sprintf ("[hex%.2X]",ord($char)); } __END__ Prints: VAR is:Some random text. More Even More. And yet More. Output of loop: Some random text.[hex0A][hex09]More[hex0A][hex09]Even More.[hex0A][hex +0D][hex09] And yet More.