Dear All...

 
Post new topic   Reply to topic    Aprelium Forum Index -> Perl
View previous topic :: View next topic  
Author Message
shidlingayya
-


Joined: 30 Apr 2008
Posts: 1

PostPosted: Wed Apr 30, 2008 12:53 pm    Post subject: Dear All... Reply with quote

Dear All
The My problem is :-

1. I have one directory called CUBAS_ComStack_COMMON

2. I have to separate .C and .H files

3. The .C files contains Upper case preprocessors(# include "CAN.h") I have to convert this into lower case (# include "can.h")

So for i have done following code but i am not getting correct result..any body help me greatly appriciated..

Code:

use File::Spec::Functions qw/rel2abs splitpath catfile/;
use strict;

sub mmm_good {
  my $d = rel2abs($_[0]);
  mkdir $d unless -e $d;
  die unless -d $d;
  return $d;
}

my(%dirs);
$dirs{c} = mmm_good('source');
$dirs{h} = mmm_good('header');

for my $path (map((glob $_), @ARGV) {
  next unless $path =~ /.([chCH])$/ && -r $path;
  my $ext = lc $1;
  open my $in, "<", $path;
  open my $out, ">", catfile($dirs{$ext}, (splitpath($path))[2]);
  while(my $line = <$in>) {
    $line = lc $line if /^\w*#include/;
    print $out $line;
  }
  close $out;
  close $in;
}



I am using windows 2000 operating system and VC++ compiler
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Apr 30, 2008 2:37 pm    Post subject: Re: Dear All... Reply with quote

shidlingayya,

How does your question relate to Web servers and scripts that could be used on them?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Perl All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group