#!/afs/athena/contrib/perl/perl

while(<>){
    $code .=$_;
}

while($code =~ /[\$\@]([\w]+)(.)/g){
    print(stderr "Identified variable: $1 \"$2\"\n") unless $vars{$1};
    $vars{$1}++;
}

for $v (keys %vars){
    next if $v eq "_";
    next if $v eq "ARGV";
    next unless $v =~ /\D/;
    $bv = &make_bad_var($n++); 
    print(stderr "$v is becoming $bv ($n)\n");
    $code =~ s/([\$\@])$v(\W)/\1$bv\2/g;
}
$code =~ s/\n\s+/\n/g;
$code =~ s/\n/CRHERE/;
$code =~ s/\n//g;
$code =~ s/CRHERE/\n/;

print($code);
print("\n");
sub make_bad_var {
    local($bvarnum) = @_;
    local($badv) = "l";
    for $bit (0..7){
	if(vec($bvarnum, $bit, 1)){
	    $badv .= "l";
	}
	else{
	    $badv .= "1";
	}
    }
    $badv;
}
