Perl Users,
Firstly my apologies for my very elementary knowledge of Perl.
Thanks to ideas from Sena and Mustafa, and a lot of assistance from Bill
Luebkert on an earlier script, I have below a snippet from a script which I
tohught should work.
The problem is $base_dir, which is supposed to be
/home/Mumba/archive/11-November08/ukmo/20081115 is being put on several lines as
/home/Mumba/archive/11
-
November08
Hence my chdir ("$base_dir/$dat") gives the error "cannot cd", no such file or
directory. I have another script which works, with a similar but even longer
directory. I do not see the difference.
Is there some trick I can do to force the whole directory on one line?
Thanks
my $base_dir="/home/Mumba/archive/$model_mon$dash$mon_name$yr/$model";
#
chdir ("$base_dir/$dat") || die "Sorry, couldn't cd: $!";
my @files =<$base_dir/$dat/*>;
foreach my $file (@files) {
print "Catting $file\n" if $debug;
system("/bin/cat @files > $model$cycle$grib_ext") or warn "Failed '$file':
$! ($^E)";
}
#
system("/usr/bin/perl /usr/local/bin/grib2ctl.pl -verf $model$cycle$grib_ext" >
"$model$cycle$ctl_ext");
system("/usr/local/grads/bin/gribmap -i $model$cycle$ctl_ext -v -e");
#
opendir (BASE,"$base_dir/$model/$dat") || die "Cannot open BASE: $!";
while ($file = readdir(BASE)) {
system("rm $file)\n") || warn "Having trouble deleting $file: $!";
# unlink($file)
}
closedir(BASE);
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs