When i run the .html files in the browser i got error which as follows: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>'; } } }
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?file:///project/data/data_works%20/data_digital%20.html
In reply to How to remove the spaces after the directory name and before the .html extension from my code using perl? by gpssana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |