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: Re: [mohan] Searching for a string: Edit Log



Tejas
User

Jan 28, 2015, 5:03 AM


Views: 13557
Re: [mohan] Searching for a string


Code
use strict;  
use warnings;

use Cwd;

my $Directoryname = getcwd();

print "My Current Dir is $Directoryname \n";

my @files;

opendir(mydir, $Directoryname) or die "cannot open directory $Directoryname";
@files = map { "$Directoryname/$_" } grep(/\.css$/,readdir(mydir));

foreach my $file (@files) {
open my $handle, '<', $file or die "could not open '$file': $!";
while (my $line = <$handle>) {

if ($line =~ /font-size/) {
if($line !~ /%/){
print "\n Forced Font is detected. -- $line\n";
}
else {
print "\n Font is specified in % -- $line \n"
}
}

if ($line =~ /line-height/) {
print "\n Forced Line-height is detected. \n";
}


if ($line =~ /position:absolute/) {
print "\n position:absolute is detected. \n";
}

}
close($handle);
}

Try Testing above..its the same but removing an extra .


(This post was edited by Tejas on Jan 28, 2015, 5:40 AM)


Edit Log:
Post edited by Tejas (User) on Jan 28, 2015, 5:40 AM


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

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