Hello,
I've searched far and wide for an answer to a question that I have, but did not find anything that could help me achieve what I would like to do.
I have a delimited text file (CSV) with fields that resemble these below that repeats/resemble 18 times (I only included 3 rows for an example).
It's a regularly updated database where Row-1, 2 or 3 etc, stand to change from "open" to "closed".
<img src='/images/closed.gif'>;Row-1;<img src='/images/open.gif' align='absmiddle'>;<img src='/images/closed.gif' align='absmiddle'>
<img src='/images/closed.gif'>;Row-2;<img src='/images/closed.gif' align='absmiddle'>;<img src='/images/closed.gif' align='absmiddle'>
<img src='/images/closed.gif'>;Row-3;<img src='/images/open.gif' align='absmiddle'>;<img src='/images/closed.gif' align='absmiddle'>
With the (working) code I have below, I would like the script to "print" the output, but only if the string "open.gif" exists on any given line, and NOT printing if it is not.
It would be appreciated, thank you.
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use strict;
my $csvfile = "/my_file.txt";
print "Content-Type: text/html\n\n";
open (CSV, "< $csvfile");
while( <CSV> )
{
my @cols = split(/;/, $_);
if (2..18) {print "Row-1: $cols[0]<br>Row-2: $cols[1]<br>Row-3: $cols[2]"
}
}
close CSV