Jul 27, 2005, 9:55 PM
Post #3 of 3
thanks for the answer davorg.
Re: [davorg] Counting characters
[In reply to]
now i want to count for more than 1 word and the input is from the stdin. the number of matches characters (n) is printed in the form of power 2 (2^n) (ex: 1, 2, 4, 8, etc ).
each one is separated by space.
actually i have make some code, but i need shorter code, if u have any idea how to make it shorter, please reply me soon, thank you.
print "2**($a=/[FTLD]/g) " while<>
after i read your reply:
print 2**(tr/'FTLD'//).$/ while<>
and i've changed it again:
print 2**y/FTLD//.$/ while<>
note: you can omit all the 'use' keyword, etc. just make it very very short
i want to make it 24 characters length of code or less
(This post was edited by ronald29x on Jul 28, 2005, 2:07 AM)