in reply to Transliteration

You could use the s operator instead of tr. Something like this:
$fcast =~ s/=\s*$//g;
will delete a '=' followed by any amount of whitespace (including newlines) at the end of the string. If each string (this is, each element in %$forecast ends that way, you may want to apply the substitution to each element before concatenating them into $fcast.

The '=' at the end of each line sounds like some form of MIME encoding to me. If this is the case, and later you encounter that some other things come encoded in funny ways, you may want to look at the existing MIME:: packages on CPAN.

Replies are listed 'Best First'.
RE: Re: Transliteration
by BBQ (Curate) on May 03, 2000 at 06:20 UTC
    Which brings us to another interesting question... What is the main difference between tr///? and s///? And I don't mean syntatically speaking!

    Why would someone use one or the other in a specific case? I tend to be more of the sort that always uses s///'s. I have a bad habit of learning one way to do it, and sticking through with what I know works. (other examples would be the use of foreach instead of while, or !($var eq $val) instead of ($var ne $val) and I know the latter is the correct form...)
      The main difference is speed. tr/// doesn't do interpolation or use the regex engine, so it is blazingly fast in comparison. It's very good for transliterating characters (if you've ever studied a dead language that didn't use the Arabic alphabet, you'll understand).

      s/// is more flexible -- it uses the regex engine and allows character classes. It can also perform nearly abitrarily complex interpolation.

      You can get by with just s///, so if you're in doubt, go for it. Just be aware that, used correctly, tr/// will run rings around it.

      I also habitually use s/// where I could use tr///.

      The main difference is with s/// you can use regular expressions, while in tr/// you cannot. Also (from the camel book) "the translation table is built at compile time, neither the SEARCHLIST nor the REPLACEMENTLIST are subject to double quote interpolation." So that means:$str =~ tr/$mylist//d; Will delete all occurances of "$, m, y, l, i, s, t" in $str. Probably not what you want.

      Also since the tr/// cannot use regex's it is usually a lot faster. I did a benchmark to that here.
      damnit, wrong link again... sorry!