On 9/3/2013 1:08 PM, Matt wrote:
I have this:

while (<IN>) {
     chomp;
     next if /^#/;
     # do stuff
     }


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?


I dunno..  maybe:

while (<IN>) {
    chomp;
    next if /^#/;
    next unless /^[a-z0-9_-. ]+$/;
    # do stuff
    }

I didn't actually test this, so it is simply a shot in the dark, but it might be a good place to start.

Nathan


--
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