Re: how to shorten this code ? x occur how many times in variable

[email protected] (Richard Lee)
Newsgroups perl.beginners
Message-ID <[email protected]>
John W. Krahn wrote:
> Richard Lee wrote:
>> Rob Dixon wrote:
>>>  
>>> returns the number of colons found but leaves them untouched. Similarly
>>>
>>>   $str =? tr/\t /_/;
>>
>> this is great!!
>>
>> use warnings;
>> use strict;
>>
>> my $str = 'ab:cd:ef:g:hi::now;';
>> print $str =~ tr/:// . "\n";
>> print $str =~ tr/:b/_X/ . "\n";
>>
>> print "$str\n";
>>
>>
>> ././././././testthis.pl
>> 6
>> 7
>> aX_cd_ef_g_hi__now;
>>
>> BTW, what is =?    ? or is that a typo?
>>
>> $str =? tr/\t /_/;
>
> Typo.
>
>
> John
thank you!!

I have been putting off learning the meaning behind tr.. but now I 
finally got to learn them and see that they are very useful

thank you.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.