$ cat test1.pl #!/usr/bin/perl $string = 'test'; $inputs = 'test.txt'; open(TABLE, $inputs) or die "can't open $inputs.\n"; while ( $line = ) { if ( $_ =~ $string ) { print $_; } } close(IN); $ cat test.txt test tst $