On 3 Sep 2013, at 18:08, Matt <matt.mailingli...@gmail.com> wrote:

> It skips to the next item in the while loop of the string begins with
> # and works fine.  I would also like to skip to the next item in the
> loop if the string contains anything other then lowercase,
> underscores, numbers, dashes, periods, and spaces.  I do not want
> uppercase characters and any sort of other special characters.  How
> would I do that?

Try this:

#!/usr/bin/perl
use strict;
while (<DATA>) {
   #chomp;
   next if /^#/;
   next unless /^[a-z0-9 -\._]+$/;
   print;
}
__DATA__
good
bAd
go-od.
#bad

JD


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to