#!/usr/bin/perl use strict; use warnings; while (<>) { chomp; my $orig=$_; s|//.*||; # strip comments if (/\b(printf|scanf|open|close|read|write)\b/) { print "Found keyword '$1' in '$_'.\nOriginal line: '$orig'\n"; } }