#!/usr/local/bin/perl open (IN, "/text.txt"); while (){ if ($_ =~ /hello/){ # do what ever } } close IN;