#! perl use strict; use warnings; my $xml = 'file:/path1/to/some/file.mxf' . 'file:/path2/to/some/file.xml'; my $lmx = reverse $xml; my ($htap) = $lmx =~ /lmx\.(.*?):elif/s; if (defined $htap) { my $path = reverse $htap; print "Path: $path\n"; } #### 23:32 >perl 1335_SoPW.pl Path: /path2/to/some/file 23:32 >