
tomitzel
New User
Oct 11, 2012, 11:55 PM
Post #3 of 8
(3125 views)
|
Re: [BillKSmith] Replace whitespace with hyphen, ASCII code problem instead
[In reply to]
|
Can't Post
|
|
I am just going to post the subroutine in which it is that line, the file has over 2000 lines of code.
sub encode_dir { my ($fstring) = @_; my ($ms, $enc_string, $oneletter, $bstr); $fstring =~ s/ /-/g; for ($ms = 0; $ms < length($fstring); $ms++) { $oneletter = substr($fstring, $ms, 1); if (($oneletter !~ /[0-9a-zA-Z]/) and ($oneletter ne "-")) { $bstr = ord($oneletter); if (length($bstr) == 1) {$bstr = "00" . $bstr;} if (length($bstr) == 2) {$bstr = "0" . $bstr;} $bstr = "," . $bstr; $enc_string = $enc_string . $bstr; } else { $enc_string = $enc_string . $oneletter; } } return ($enc_string); } |