#!/usr/bin/perl -w use strict; while (my $line = <DATA>) { chomp $line; if ($line =~ /#include [<"](\w+\.h)[>"]/) { print "file is: $1\n"; } } __DATA__ #include "string.h" #include <string.h>
Note that your usage of \w matches only one character — you'd need \w+ to match more than one. Also, you have the .h outside of the <...> or "...".
In reply to Re: Checking the include form and getting only the header name
by Eliya
in thread Checking the include form and getting only the header name
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |