#!/usr/bin/perl -wp # Print all lines before the first one that matches the pattern. # Does a case-insensitive match. # The pattern is the first argument. # All other arguments are treated as files to read; if none are supplied, # standard input is read. # Output goes to standard output. BEGIN { $pattern = shift @ARGV; } if (/$pattern/io) { exit; }