in reply to Printing just the file name for all the cases
use strict; use warnings; while (my $line = <DATA>) { if ($line =~ /#include [<"](\S+\.h)[>"]/) { print "$1\n"; #not printing the header third case } } __DATA__ #include "string.h" #include <stdlib.h> #include <sys/dispatch.h>
Prints:
string.h stdlib.h sys/dispatch.h
which is what I understand you to want, so where's your problem?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing just the file name for all the cases
by Anonymous Monk on Mar 20, 2011 at 08:49 UTC | |
by GrandFather (Saint) on Mar 20, 2011 at 08:58 UTC |