Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regex in an 'if' statement

Status
Not open for further replies.

AMiSM

Technical User
Joined
Jan 26, 2006
Messages
128
Location
US

Greetings!

Does anybody know how to use a regular expression in the eval portion of an 'if' statement? This doesn't work:

if ( $text[$z] ne m/\231/g ) {
$output = "$output $text[$z]";
}

I'm trying to execute code if the string does NOT contain ASCII #231.
 
if ( $text[$z] ne m/\231/g ) {

should be like this:

if ( $text[$z] !~ m/\231/g ) {
 

I was close :)

Thanks, man
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top