HEX
Server: Apache
System: Linux iad1-shared-e1-26 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User: ricpug (13815490)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //dh/bin/change_email_header.pl
#!/usr/bin/perl

use strict;

my $header = shift @ARGV;
my $add = shift @ARGV;

$add =~ tr/+/ /;
$add =~ s/\%([A-Z0-9][A-Z0-9])/pack("C",hex($1))/eg;

$add .= ' ' unless $add =~ /\s$/;

# read headers
while (<>) {
	chomp;
	last if $_ eq '';    # end of headers!

	my ($h, $v) = /^(\S+): (.*)/;
	if (defined $h) {
		if ($h eq $header) {
			$v = $add . $v;
		}
		print "$h: $v\n";
	} else {
		print "$_\n"; ## weird
	}
}

# sep
print "\n";

# body
while (<>) {
	print;
}