in reply to Regex to check for beginning character

There are a couple of problems. First (in order of appearance), you don't need the /g modifier. You're only looking for the first case in each array element, so /g is useless. Second, !=~ isn't really what you're looking for. If you want it to return true when a match occurs, use =~ If you want it to return false when a match occurs, use !~

Also, if you leave off the =~ operator, $_ is implicit, so you could actually just say if ( m/^#/ ) {.....


Dave