http://qs1969.pair.com?node_id=384007


in reply to Re: regex match with interpolated pattern
in thread regex match with interpolated pattern

ok men, I tried all 3 suggestions and none worked so here is my code. Again $dm and $dmm are dereived from the subroutines are are in format xx/xx/xx
sub date_manip { my ($month, $day, $year) = (localtime)[4,3,5]; sprintf ("%02d/%02d/%02d\n", $month+1,$day,($year % 10 +0)); } my $dm = '&date_manip'; sub date_manip1 { my $days = (shift); my ($d, $m, $y) = (localtime($time - $days * 86400)) [ +3..5]; sprintf ("%02d/%02d/%02d", $m+1,$d,($y % 100)); } my $dmm = '&date_manip1(1)'; #print ("$dm $dmm"); ############################################################ ## Gather data for scratch tapes; open file, create list, then print i +t. ## ############################################################ open (FOO, ">$scratches") || die "could not open file:$!"; #($^I, @ARGV) = ('.bak', $scratches); open (D, "$logf") || die "could not open file:$!"; while (<D>) { ## look for 9840S and ebexpire ## declare OFS = tab ## tell split to split on IRS 0,1&5. # if (($_ =~ /9840S/) && ($_ =~ /ebexpire, ebexpire/ ) +) { if (($_ =~ /9840S/) && ($_ =~ /ebexpire, ebexpire/ ) & +& ( $_ =~ m/$dm/) && ($_ =~ m/$dmm/)) { local $, = "\t"; print FOO +(split)[0,1,5], $/ ; } } close (FOO); close (D);