On Thu, 2008-09-04 at 17:54 -0400, Moon, John wrote:
> Does anyone know the octal code for what vi is showing as "^L"? I tried
> "\n\r" & \r\n" but that does not seem to be the same... I am on a UNIX
> box... I need the octal code to add to the beginning of first record
> written from my perl script... I'm using "write" and "format" and need
> ALL headers to be alike... the first is w/out the "^L"... 
> 
> Thank you in advance...
> 
> John W Moon
> 
> 

use Perl;

#!/usr/bin/perl

use strict;
use warnings;

my $char = 'L';

my $ctrl_code = ord( $char ) - ord( '@' );
print  "control code: ^$char\n";
printf "decimal:      %d\n", $ctrl_code;
printf "octal:        \\%03o\n", $ctrl_code;
printf "hexadecimal:  \\x%02x\n", $ctrl_code;

__END__

-- 
Just my 0.00000002 million dollars worth,
  Shawn

"Where there's duct tape, there's hope."
        Cross Time Cafe

"Perl is the duct tape of the Internet."
        Hassan Schroeder, Sun's first webmaster


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to