At 10:45 am +0800 21/11/02, Peter N Lewis wrote:

 if (/\015\012/) {
  $/ = "\015\012" ;
 } elsif (/\015/) {
   $/ = "\015" ;
 } else {
   $/ = "\012" ;
 }
You can do this with one regular expression which will pick up the first line ending:

$/ = /(\015\012|\015|\012)/ ? $1: "\n";
Very nice! The only reason I post these things is to get you experts to reply with something ten times better :-)

Now why don't I get a bell but when I do ( print "\a" ) or ( print \007 ) in 10.2.2/Perl5.8.0? It works fine in MacPerl and no character is "printed" but in OS 10 the only way I've found is:

$/ eq "\015" and `osascript -e beep` ;

which slows things down a lot.


JD


Reply via email to