I
assume that what you're looking for here is the string '
/org/trans/program files/dir1/subdir1/subdir2/file1.cpp'.
Crafting a regex to extract the file name without having a format you can rely on is going to be tricky.
However, if you are always going to be looking for a '
.cpp' file, then the following will work:
#!/usr/bin/perl -w
use strict;
my $data = join '', <DATA>;
my ($filename) = ($data =~ m|^Module: (.*\.cpp)$|ms);
$filename =~ s|\n||;
print $filename;
__DATA__
Module: /org/trans/program
files/dir1/subdir1/subdir2/file1.cpp
some flags
some history