# open the file open INFILE, '<', 'my_column_file.txt' or die "Couldn't open 'my_column_file.txt' $!"; while ( ) { my ( $row_num, @fields ) = split; print if @fields == grep /r/, @fields; }