Sorry if this is an FAQ but I haven't found it in the perlre manpage. I found this behavior on BS2000 first, but my current Linux version (5.005_03 in the company as well as a 5.6 at home) do the same thing: ~> perl -e '$line = "xx\n"; $line .= " " if $line =~ m/\S$/; print ">$line<\n";' >xx < ~> perl -e '$line="xx\n";$line.=" "unless $line!~m/\S$/;print ">$line<\n";' >xx < \n is treated as non-whitespace here (see below for the thing really happening). A few more tests show: ~> perl -e '$line="xx\n";$line=~s/\s/y/g;print ">$line<\n";' >xxy< ~> perl -e '$line="xx\n";$line=~s/\s$/y/g;print ">$line<\n";' >xxy< ~> perl -e '$line="xx\n";$line=~s/\S$/y/g;print ">$line<\n";' >xy < ~> perl -e '$line="xx\n";$line=~s/\S/y/g;print ">$line<\n";' >yy < It seems, that $ matches the end of the string *except* when the last character is a newline, this seems to be ignored in that case. Is this the intented behavior (= is this a feature) or should this be considered a bug? Thomas PS: At the moment I'm using $line and substr($line,-1) =~ m/\S/o as an awkward substitution which is working as intented (by me ;-). Viele Grüße, Thomas ________________________________________ Thomas Dorner START AMADEUS, Technologiestrategie (I-T) Tel.: (0 6172) 91 - 26 41 Fax: - 55 26 41 E-Mail: Thomas.Dorner@start.deThread Next