use strict; use warnings; use File::Basename; while (my $line = <DATA>) { if ($line =~ /#include [<"](\S+\.h)[>"]/) { print basename($1), "\n"; } } __DATA__ #include "string.h" --> below code prints header #include <stdlib.h> --> below code prints header #include <sys/dispatch.h> --> not able to get the header name(dispatch +.h)
In reply to Re: Printing just the file name for all the cases
by moritz
in thread Printing just the file name for all the cases
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |