#!/usr/local/bin/perl use strict; open( FILE, "file" ) || die $!; while( ) { if( /regexp/ ) { print; last; } }