• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 119
  • Last Modified:

Uppercase sensing?

I admin a forum at work, and it is based upon Perl.  Now, I have some users who can't seem to find their 'Caps Lock', and turn it off.  I know it sounds silly, but it is a pet-peave of mine that people type in all caps.

I know that Perl has a lc( EXPR ) function, that will return an all-lowercase version of 'EXPR'.  But I don't want to run that on all the posts.  I only want to run it on the posts where everything is in all capital letters.  I realize that this means that good grammer is thrown out the window, but they started it! ;)

Question:

How can I read if string $post is made up of all capital letters?
0
chrisshaffer
Asked:
chrisshaffer
1 Solution
 
rj2Commented:
#!/usr/bin/perl
$post="ONLY CAPITAL LETTERS HERE!";
if($post =~ m/[a-z]/) {
     print "Found some small letters";
} else {
     print "Only capital letters in post";
}    
0
 
chrisshafferAuthor Commented:
Looks good.... Thanks for the quick response.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now