#!/usr/local/bin/perl

use strict ;
use warnings ;

use Benchmark ;

my $len = 10 ;
use constant LEN => 10 ;
my $text = 'abc' ;

my $pad = "\0" x $len ;

timethese( shift || -2, {

		or => '$text | $pad',
		xor => '$text ^ $pad',
		padx => '$text . ("\0" x ( $len - length( $text ) ) )',
		pad_substr => 'substr( $text . ("\0" x $len), 0, $len )',
		pad_substr3 => 'substr( "$text$pad", 0, $len )',
		padx2 => '$text . ("\0" x ( LEN - length( $text ) ) )',
		pad_substr2 => 'substr( $text . ("\0" x LEN), 0, LEN )',
	}
) ;
