> ################################
> # This might come closer to what you want.
>
> foreach my $log (@NBlogs2) {
> if ($log =~ m{([[:alpha:]]+)/log.\d+}) {
> my $word = $1;
> my $number = $subdir_for{$word};
> qx(echo cp $log $oldir/$number);
> }
> }
##################################################
I used Data::Dumper to test this code and am wondering
why the scalar variable assign. my $number is not
working or "sticking"??? See below
foreach my $log (@twoweekdir_contents) {
$NBlogs2[ $i++ ] = $log
if ($log =~ /bpcd\/log|bpdbm\/log|bptm\/log\.\d+/);
}
if (@NBlogs2) {
foreach my $logs (@NBlogs2) {
if ($logs =~ m{([[:alpha:]]+)/log\.\d+}) {
print "word variable assgn:\t",
Dumper(my $word = $1);
print "number assgn from hash:\t",
Dumper(my $number = $subdir_for{$word});
print "word output:\t",
Dumper($word,"\n");
print "number output:\t",
Dumper($number,"\n");
print "copy call:\t",
Dumper(qx(echo cp $logs $oldir/$number) );
}
}
}
else {
print LOG dateme(),
"\nArray NBlogs2 is null $!";
die $!;
}
__END_CODE__
If I change $number to $word is obviously does the
copy correctly, but what is the point of
my $number = $subdir_for{$word};
???
__CODE_OUTPUT__
word variable assgn: $VAR1 = 'bpcd';
number assgn from hash: $VAR1 = 8;
word output: $VAR1 = 'bpcd';
$VAR2 = '
';
number output: $VAR1 = 8;
$VAR2 = '
';
copy call: $VAR1 = 'cp
/usr/openv/netbackup/logs/bpcd/log.082906
/usr/openv/logs/old/8
';
word variable assgn: $VAR1 = 'bpdbm';
number assgn from hash: $VAR1 = 13;
word output: $VAR1 = 'bpdbm';
$VAR2 = '
';
number output: $VAR1 = 13;
$VAR2 = '
';
copy call: $VAR1 = 'cp
/usr/openv/netbackup/logs/bpdbm/log.082906
/usr/openv/logs/old/13
';
word variable assgn: $VAR1 = 'bptm';
number assgn from hash: $VAR1 = 39;
word output: $VAR1 = 'bptm';
$VAR2 = '
';
number output: $VAR1 = 39;
$VAR2 = '
';
copy call: $VAR1 = 'cp
/usr/openv/netbackup/logs/bptm/log.082906
/usr/openv/logs/old/39
thank you
derek
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>