dimanche 12 février 2017

How can i convert multiple text files into same filename with .html files format using perl?

Vote count: 0

Code which i have tried for single file:

#!/usr/bin/perl
use strict;
use warnings;

open my $HTML, '>', 'h.html' or die $!;

print $HTML <<'_END_HEADER_';
<html>
<head>
<body>
_END_HEADER_

open my $IN, '<', 'h.txt' or die $!;
while (my $line = <$IN>) {
    # You probably want to do more work here.
    print $HTML $line;
}

print $HTML '</body></html>';
close $HTML or die $!;

Query:

The above code converts .txt to .html file format.In this code i have tried for single file.I got struck with how can i do for multiple files from the folder using perl?

asked 22 secs ago

Let's block ads! (Why?)



How can i convert multiple text files into same filename with .html files format using perl?

Aucun commentaire:

Enregistrer un commentaire