next if substr($fld0,-1,1) eq "X"; #### next if $fld0 =~ /X$/; #### $ Match the end of the line (or before newline at the end)