CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: How to print all the file name irrespective of the file extension?: Edit Log



iphone
User

May 31, 2010, 7:26 PM


Views: 2079
How to print all the file name irrespective of the file extension?

Hi friends,

I am trying to all the lines that has a ".c" extension using the following script,for some reason the the matching pattern "$_ =~ /^.*\.c\z/s"doesn't seem to work.Can some pls help?When i run this script nothing gets printed

use strict;

open FILE, "<features.txt";
my @line = <FILE>;

#print "Lined that matched $find\n";
foreach (@line) {
chomp(@line);
if ($_ =~ /^.*\.c\z/s)
{ print "in f";

print "$_\n";
}
}
close (FILE);


(This post was edited by iphone on Aug 22, 2010, 11:55 PM)


Edit Log:
Post edited by iphone (User) on Aug 22, 2010, 11:55 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives