#!/usr/bin/perl -w $regex = shift or die "no regex"; undef $/; $_ = <>; while($_ =~ /$regex/gc) { printf "match at \$%04X\n", $-[0] + 0x8000; }