What that if statement achieves is a check on the successful concatenation of the results of performing 2 separate regex checks /check_geomtools.exe:/ and /\.lib$/ .
I take it you actually want to match a line of the form:
/check_geomtools.exe:/.*\.lib$/
Your split probably wants to be on just a colon, rather than a colon followed by a space.
Your bizarre assumption that the split statement would result in a multi-dimensional array is incorrect...
So taking these on board...
#!/usr/bin/perl
use strict; #These two lines will
use warnings; # save you hours of debugging time
use File::Copy;
my $my_file = "makefile";
open(my $makefile,'<', "$my_file");
while(<$makefile>)
{
if(/check_geomtools.exe:.*./\.lib$/)
{
chomp;
my (@libs = split(/:/,$_));
mkdir "Scratch";
foreach my $my_libs(@libs)
{
copy($my_libs, Scratch)
}
}
}
After splitting the path i am trying to copy "$libs[1]" to the directory named "scratch". once "$libs[1]" i copied to scratch. I need to zip(scratch) and copy it to some other location and lastly, delete scratch.
#!/usr/bin/perl
use strict; #These two lines will
use warnings; # save you hours of debugging time
use File::Copy;
use File::Basename;
my $my_file = "makefile";
open(my $makefile,'<', "$my_file");
while(<$makefile>)
{
if(/check_geomtools.exe: (.*./\.lib)$/){
my $full_path=$1;
chomp($full_path);
my $filename = basename($full_path);
mkdir "Scratch" if ( ! -d Scratch) ;
copy($full_path, "Scratch/$filename");
}
}