please help me with a regular expression to check,
1) if "check_geomtools.exe" is present in the path and then check if the string ends with ".lib"
2) if returns true, a command should be there to "grep all .lib from the file and copy them into a new directory.
use File::Copy ;
my $newdir = $ENV{$TEMP} ;
my @copylibs = () ;
# escape our seaarch strings that come in a regex
my $copyflag = qq[\Qcheck_geomtools.exe\E] ;
my $copystart = qq[\Q: \E] ;
my $copylib = qq[\Q.lib\E] ;
# filter first
while (<>) {
/$copyflag$copystart(.+$copylib)$/ ;
push @copylibs, $1 if length( $1 );
}
#and copy
copy($_, $newdir) for $_ (@copylibs) ;
Thanks hadewych for the reply. Since i am new to perl script therefore unable to get the script.
Could you please help me out with an easy script.
thanks.
Glitches were:
$ENV{$TEMP} > $ENV{'TEMP'}
Newer Perls choke on for $_ 
Newer Perls need a regex reset with m/./ between each m// and s///; ;
use File::Copy ;
my $newdir = $ENV{'TEMP'} ;
my @copylibs = () ;
# escape our seaarch strings that come in a regex
my $copyflag = qq[\Qcheck_geomtools.exe\E] ;
my $copystart = qq[\Q: \E] ;
my $copylib = qq[\Q.lib\E] ;
# filter first
while (<>) {
m/./;
m/$copyflag$copystart(.+?$copylib)\s*$/ ;
my $copy = $1 ;
push @copylibs, $copy if length( $copy ) and not scalar grep /\Q$copy\E/, @copylibs ;
}
#and copy
warn $_ and (copy ($_, $newdir) or warn 'ERROR while copying') for (@copylibs) ;
save as cpylibs.pl
perl cpylibs.pl < mylogfile