Here i add my part of code.
my @files = File::Find::Rule->file ->name('*.txt') ->prune ->in($output_dir); + foreach my $file (@files) { my ($name, $root, $ext) = $file =~ m|(.*)/(.*)\.(.*)|; my $outfile = "$name/$root.html"; my $head = " <!doctype html> <html lang=\"en\"> <head> <meta charset=\"utf-8\"> <title>DCMS_CHECKLIST</title><tr>< +td></td></tr> </head> <body> <table> <th>SL.NO</th><th>CHECKLIST ITEM</th><th>VALUE</th><th>COMMENTS</t +h><th>CONFIRMATION</th> <style> .bold { font-weight: bold; } .bold td { border: 0px; } table, th, td { border: 1px solid black; } </style>"; open my $fh_out, '>', $outfile or die "Can't open $outfile: $!","\ +n"; open my $fh, '<', $file or die "Can't open $file: $!"; while (my $line=<$fh>) { my @data = split /:/, $line; my $class = $data[0] ? 'normal' : 'bold'; print $fh_out qq[<tr class="$class">]; my $check=0; my $dolink=$data[0] !~ m/[\=\%]/; for my $word(@data){ $check++; print $fh_out '<td>'; if($check==1 && $dolink ) { print $fh_out qq[<a href="$word/$word.html">$word</a>]; } else { print $fh_out $word;} print $fh_out '</td>'; } } }
When i run the .html files in the browser i got error which as follows:
file:///project/data/data_works%20/data_digital%20.html
Her %20 represents space.Why space is appended at the end of the folder and before the .html extension.Where should i change my code in my script?

In reply to How to remove the spaces after the directory name and before the .html extension from my code using perl? by gpssana

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.