html to csv conversion

thanks for allowing me to join your forum

i have a html file with three columns ------------Last visit date , URL and link,,,,,,,, how can i convert the same into csv so that i can output into database... the mechine is linux...i made a little googling and got idea that there is ways for conversion using bash and perl./....but dont know how to.........

any ideas please
thanks in advaance
ayyappan

i m here by attaching my html file

#! /usr/bin/perl

use strict;
use warnings;

open (my $file, "<", $ARGV[0]);
my @lines=(<$file>);
my $lines = join ('' , @lines);
while ($lines =~ m{<tr>\s*<td[^>]*><br>\s*([^<]*)\s*</td>\s*<td[^>]*><br>\s*<A\s*HREF="([^"]*)">Click\shere\sto\sfollow</A>\s*</td>\s*<td[^>]*><br>\s*([^<]*)\s*</td>\s*</tr*>
                   }gx){
    print "\"$1\",\"$2\",\"$3\"\n";
}

the code above will do it, though if this is an assignment there will be a few questions on that regex :wink:

thanks for the reply

but when i tried to run the script , it is showing error

line 4: use: command not found
 line 5: use: command not found
 line 7: syntax error near unexpected token `my'
line 7: `open (my $file, "<", $ARGV[0]);

any help please

---------- Post updated at 05:55 AM ---------- Previous update was at 04:21 AM ----------

sorry it was my mistake.......... i forgot to save the file as .pl.........

now its wking fine

thanks a lot