pglinx has asked for the wisdom of the Perl Monks concerning the following question:
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: replace in lines
by ikegami (Patriarch) on Aug 01, 2007 at 19:11 UTC | |
by snopal (Pilgrim) on Aug 01, 2007 at 19:34 UTC | |
by Anonymous Monk on Aug 01, 2007 at 19:24 UTC | |
by ikegami (Patriarch) on Aug 01, 2007 at 19:57 UTC | |
by snopal (Pilgrim) on Aug 01, 2007 at 19:39 UTC | |
by pglinx (Acolyte) on Aug 01, 2007 at 22:13 UTC |