in reply to Re^2: print only uppercase sentences
in thread print only uppercase sentences
Watch out, though. It is working on the question you asked in the text of your post with the 3 examples you gave (because only the 1st sentence has a capital U), it is not a valid answer to the more general question in the title of your post. For this more general question, I would rather suggest something like this:
print if $_ eq uc $_;Or yet simpler:
print if $_ eq uc;UPDATE: following polypompholyx's answer, I just want to clarify that my first answer was sort of a practical joke, something that would work fine in the specific case you presented (the question as asked in the original post and the example), but would most probably not do what you really wanted, the reason being that the question was very poorly defined (an example is very rarely a good specification). When I saw that you seemed to have bought it, I felt compelled to correct this false impression, with the above post and a real solution. The two code snippets above probably do what you want (in the right context), my first post did *not*, it worked only in the specific case of your example. As polypompholyx said, my idea was to try to let you think about why it would work with your example, but most probably not do you are looking for. Think about it, an example is usually very useful, but it is never a substitute for a good spec.
|
|---|