#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1138025 use strict; use warnings; $_ = < file:/path/to/some/file.mxf file:/path/to/some/file.xml END print m{.*file:(.*?\.xml)}s ? $1 : "xml not found";