in reply to printing just part of data
If the part you want to keep starts at a fixed column then use substr to retrieve it:
#!/usr/bin/perl -w use strict; use warnings; my $file = "./max/base/file.c: \$(ROOT)/../../../api/maX \\"; $file = substr $file, 25; print "$file\n";
Prints:
$(ROOT)/../../../api/maX \
Note in passing that you need to quote the $ for $(ROOT) in double quotes because Perl will see it as the special variable $( otherwise. If you actually wanted two \ characters at the end of the string you need to provide four ('\\\\') because \\ 'escapes' a \ and generates a single \ as a result.
|
|---|