#!/usr/local/bin/perl5 # create a date+time string $shortdate = `date +"%D"`; chop ($shortdate); print "$shortdate\n"; $inhouse = "Open House Information"; open(FILE, "dbase1.exm") || die "I can't open that because: $!\n"; while(<FILE>) { chop; @all = split(/\n/); foreach $line (@all) { local($AA, $BB, $CC, $DD, $EE, $FF, $GG, $HH, $II, $JJ, $KK, $LL, +$MM, $NN, $OO, $PP, $QQ, $RR, $SS, $TT, $UU, $VV, $WW, $XX) = split(/ +","/, $line); $date = $shortdate; $date_from_db = $XX; $date1 = "$date"; @newdate = split(/\//,$date1); $formate_date1 = "$newdate[2]" . "$newdate[1]" . "$newdate[0]"; $date2 = "$date_from_db"; @newdate = split(/\//,$date2); $formate_date2 = "$newdate[2]" . "$newdate[1]" . "$newdate[0]"; if ($formate_date1 > $formate_date2) { $kill = "yes"; } else { $kill = "no"; } if ($inhouse eq "$WW" && $kill eq "yes") { print "$line\n"; print "$XX\n"; print "$formate_date1\n"; print "$formate_date2\n"; print "$kill\n"; print "$WW\n"; # this is the problem need the text removed from $WW field $WW =~ s/Open House Information//g; } } } close(FILE, "dbase1.exm")
20070801 Janitored by Corion: Changed PRE tags to code tags, as per Writeup Formatting Tips
In reply to replace in lines by pglinx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |