troubleshooting Question

Double split?

Avatar of tmccar10
tmccar10Flag for United States of America asked on
Perl
18 Comments1 Solution365 ViewsLast Modified:
I have the partial script below that tables a tab delimeted flat file.

It works fine, but I wanted to only print records from the last 60 or 90 days.
(I want to maintain all the records as an archive, but I don't need to review all of them every time I look at the file.

I've been trying a sort of second "split" function to pick off the date information from the flat file. It's the second element.

I haven't found a place to insert this line, or to set the parameter of the number of days I want the report to cover:
#$fcol, $datecol, $rcol) =split /\t/ , $_, 3;#

I'd appreciate so advice.

Thanks
#########################
$text="../data/ahnew.txt";

open(DATA,$text) || die $!;
.
print "<table border=1>";
  print "<tr>";
  print "<td nowrap align=center>-CDSID-</td>";
  print "<td nowrap align=center>-Date-</td>";
  print "<td nowrap align=center>--------Requestor------- </td>";
   .
     print "<td nowrap align=center>----------Additional Info----------</td>";
  print "</tr>";
while(<DATA>){
  print "<tr>";
  foreach(split(/\t/,$_)){
    print "<td align=center>$_</td>";
  }
  print "</tr>";
}
print "</table>";
######################################
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros