while ( ) { next if ( substr ( $_, 0, 1 ) =~ /s/i ); # now do stuff with the lines you do want }